From 246e0a4c2d2d05bf2736dbb57e1694617d96c13d Mon Sep 17 00:00:00 2001 From: Jarrett Johnson <36459667+JarrettSJohnson@users.noreply.github.com> Date: Mon, 8 Apr 2024 09:55:18 -0400 Subject: [PATCH 01/17] Nucleic Acid builder and general improvements (#354) Fixes #102 #351 Migrating support from Incentive for the following: - Nucleic Acid builder in the Builder panel (Jarrett Johnson @JarrettSJohnson) - `fnab` command to build nucleic acid chains by sequence (Jarrett Johnson @JarrettSJohnson) - Improvements to nucleic acid building from native structures (Thomas Stewart @TstewDev) - highlight attachment points for improved usability (Thomas Holder @speleo3) Co-authored-by: Jarrett Johnson Co-authored-by: Thomas Stewart Co-authored-by: Thomas Holder --- data/chempy/fragments/atpA.pkl | Bin 0 -> 3448 bytes data/chempy/fragments/atpB.pkl | Bin 0 -> 3448 bytes data/chempy/fragments/atp_ttpA.pkl | Bin 0 -> 9118 bytes data/chempy/fragments/atp_ttpB.pkl | Bin 0 -> 9118 bytes data/chempy/fragments/ctpA.pkl | Bin 0 -> 3115 bytes data/chempy/fragments/ctpB.pkl | Bin 0 -> 3115 bytes data/chempy/fragments/ctp_gtpA.pkl | Bin 0 -> 9123 bytes data/chempy/fragments/ctp_gtpB.pkl | Bin 0 -> 9123 bytes data/chempy/fragments/gtpA.pkl | Bin 0 -> 3590 bytes data/chempy/fragments/gtpB.pkl | Bin 0 -> 3590 bytes data/chempy/fragments/gtp_ctpA.pkl | Bin 0 -> 9114 bytes data/chempy/fragments/gtp_ctpB.pkl | Bin 0 -> 9114 bytes data/chempy/fragments/ttpA.pkl | Bin 0 -> 3264 bytes data/chempy/fragments/ttpB.pkl | Bin 0 -> 3264 bytes data/chempy/fragments/ttp_atpA.pkl | Bin 0 -> 9121 bytes data/chempy/fragments/ttp_atpB.pkl | Bin 0 -> 9121 bytes data/chempy/fragments/utpA.pkl | Bin 0 -> 2433 bytes modules/pmg_qt/builder.py | 296 ++++++++-- modules/pmg_tk/skins/normal/builder.py | 2 +- modules/pymol/api.py | 3 +- modules/pymol/editor.py | 722 +++++++++++++++++++++++++ modules/pymol/keywords.py | 1 + testing/tests/api/build.py | 1 - 23 files changed, 971 insertions(+), 54 deletions(-) create mode 100644 data/chempy/fragments/atpA.pkl create mode 100644 data/chempy/fragments/atpB.pkl create mode 100644 data/chempy/fragments/atp_ttpA.pkl create mode 100644 data/chempy/fragments/atp_ttpB.pkl create mode 100644 data/chempy/fragments/ctpA.pkl create mode 100644 data/chempy/fragments/ctpB.pkl create mode 100644 data/chempy/fragments/ctp_gtpA.pkl create mode 100644 data/chempy/fragments/ctp_gtpB.pkl create mode 100644 data/chempy/fragments/gtpA.pkl create mode 100644 data/chempy/fragments/gtpB.pkl create mode 100644 data/chempy/fragments/gtp_ctpA.pkl create mode 100644 data/chempy/fragments/gtp_ctpB.pkl create mode 100644 data/chempy/fragments/ttpA.pkl create mode 100644 data/chempy/fragments/ttpB.pkl create mode 100644 data/chempy/fragments/ttp_atpA.pkl create mode 100644 data/chempy/fragments/ttp_atpB.pkl create mode 100644 data/chempy/fragments/utpA.pkl diff --git a/data/chempy/fragments/atpA.pkl b/data/chempy/fragments/atpA.pkl new file mode 100644 index 0000000000000000000000000000000000000000..6ef22ce9d2f0260d718d9c23ab31d28ca40fb56e GIT binary patch literal 3448 zcma)DA;YwQu#fa3VNd~5vrC*vrD_$%v zARvnipdwJj4crkC+!7TK0TGYKN2SLHI36FA;{za`9>04t(`8{ih128lhc!l18o7QBqr5N zGU7g!wJ?gpXi>$9UxyRVJ9$V#$SsXMJg0{h$~~Kf94sQLUzgY9*FtlBt=-Qn;R*ZV=sdef8@lq}|e}RTsUiNZLAo!Q+6b zrU}NW4t01(COWb-$Bh)mb4L|+Q>H~rW7dxAr4(!z|jJ z=sPsSi-qoJM8}l0`Y@v-S946IFpWE=qocB7Pm)DTWm|m`E0VS?OPpBf4p(gz%ow(h z9(=lT(P7aXw^NwO9e1E(^o~tDS{kwUR1%}{IUee0M8~YO`mmrQPjlQ!p^iHwbX@1! z*3F`&;)_9EB=h!P>&21&K5D9Qu3%|}sraHE8A?z+FTNA|EHaqieoRDI>h28x!4$3x9O>VxcPeT~-ABAE zS;`&vtCJOpOMmT3VxcQslVMR>T@<3CNK-sO!NU~~qQV|n%#)?8%V&Er85KkCh-(Tg zPD@dQ3Y(^Qh{6)CXhwx?;pHStuKTBbUrOQU?OVk$hGmcoV#yQXNN;N^-|RG3dC zySd`R{GaiNU7QzEA3^PQH%tXzTKB?^iegRSrx4%@1r^rn@x3fr%GWQ{RgcY!BYGDN z(_m>@ieglhXo_VNRIX@a_oCI^!xi?^CwP(Q8~7sfhjuzFPwPUJpu(Xk9-$EAiV!Nw zQp*P36m79e{JVG*bM<#I1Hx%_;Xp-c+?U#A_#)u|M4F*p9JI@sje`OJ-{C}M=%5f2 zRdX}MMPecu3g0u}Mh5p7D@Z1;Oe0delb8}!BCwK}aQ-GyO`YEAj|t8YLblYvrL&C$mhnysUmMzmXoH58uU=#wJJA~`ymWkjEn;b{tMIl7La{i)eT z^cfk}Q`o@KjUve*W<52>h(0UBCJLK5x`m;+I%+neTV;5T!t)$`K_s|{>u9bKeNl#O z6t;78he&dXMMo`0^d%Wyrtk_!cQQ0jNAry6t1|4Ou$!ZMM3Of!0l|p&$gr2fYaHDt z5`j4M)O;iQx(shnc$1@Vi6oy`b<}D^-#g`98HMCM(lcOu@Ozm@HK^RIQlJ{K(UUN7|~-g9H(%Cqu+_7n3U*k zIgIE@8NR1*ile9573jZPrAG9O3_nmf%h4Z2QZj&+rBKCFf{Tg%PftsGG}5j_V{J+Y MoNI=k;=W1$15Y8svH$=8 literal 0 HcmV?d00001 diff --git a/data/chempy/fragments/atpB.pkl b/data/chempy/fragments/atpB.pkl new file mode 100644 index 0000000000000000000000000000000000000000..75f5b424a20ac2f76b9f64e4dc282d7b8cf6cf96 GIT binary patch literal 3448 zcma)0g*q$>NMhk5{+cWCAoG~O0!1z6#+ve4xJT-I8fE>lhsl%^{^FM|6j4d>M#ZH!c{}zni}+D16G0Y1pn`yO`4X$M%^C40KZsnyyZ%n@n_=HOCkVW4YrR z?8bcPxPzsZhECtvzyfFQg)8P7R|e(i7`P8JIxL!_f0n8+QIu#c?OTO2I4bjhOcB^GqYtCp}pcepCcVDf-{ zbm8vGLPxgdxR%0o+;KfRtjS&LmWIswGtM1}%Ajh%J{;Ib4mt$QF@=JQJEo%J-&N}qEVWe9P!(f=bE&VI zjr2Ln%V1hc4gnpxn&T!4Ztl1l9X*r14xTy@*_;geIoJX6l*4rGka%E5|3h*%`QW+m zkmRB$PZJRew{TH4iq6;sF%uQ% z96c^E*5mJJ-rb> z`xLHma9c`U6riF|Q`}C$%N2Lvv+;zsX(h9+*nfWa@`V}?b5c?iqQa^v?xb)RSJa{6 zm-3MbR=l%UJB{5vyXMFGcQFCxrlhcS z3E)fVwc%=)(0zEbBaVTta7}{wDJ_%@6?RQ=H-#3i2(ld&U(7R0MJHxs zVpQz-c6b5!4NacgvZAg8~4*;Y4I;qYxEUOC7X} z#6;2*erLdo4Bjz1NIE{51|@GNQ6-{;VF58={U%XO&R-})Cxu0P{yl7dx}tXA8=t-P z4d}fxPzv{P^nQkB>S($Vjmhu;g$FshSR@(5tfLu5^dT7@rtkJ}JXf6rSejGYrkrQHv2>D#J1g&vJCRNbn)9qgh7uIT=<^c%Gvx zMUq9bbu`rv*9nCYMZ^-Z_g^e72OC)(DpP_8$#E2f0;Y$jKIQo@HZ0FI^B&v9A_%PA`>8WpxgjdO0o$dS&ArKY&&7q6-E+_s1c2+3lmJT+(|+a2ZId}d&6$* zViys+89O3k?}dm8iUpDPRFntroRhgbbCdf=_~Yix&3@;8bMEZS$^2+)3N2bzrw13f zU}y@pcXaAqO`Rd##Ui{-OgpQ1T3S0>+Ux3E zp~i*5rcM_dR@up-s#&zbV!Smm5fKqB_<0svSrZQjZK2j+Q&(${#cAQhuG!Y4i^Xe* zCsZ?6O*DMEp)=IR5^Gr!cW_m}jEfB)UCojWmeRjKQz)c2Gj}aZ^#+vqm9ZWm1BxeU zi;02hzVzsB2!fQcy`e40(rO}MVh&5MiG`mX%i0=4tt>-Jr%&j?j&_z=GYo!nYz51z zNrV9ATI$-n+8Tp8%T^=lw3@VrmUfmysVZ15u^qt$Ei6yVt%(9?aq|+EAMowpLLRh~ z7VK>3Y-0shiutV#3p&_{S=|v49$K)anH8!LS}gqD4H@e2{OcC!p+!NxvnANUiVWtV zGB&q2)Xfj+ZLCshwCyv- zU}MQ=oHyV*P_bHpBmt#h`ObO_O!v}{;iv60aSl5~%g`JqQ0aC0?6!=7=&ot5J zaNB3P!HyuGBf%&2hE*O&0+o5Th5|DsX{HG?;hh4Xqr}P_JA50uIId-6lv?eiN5{o9si6+O} zCIN$;KqfQ6BzMn)uq>G5c5Fm}K<|MK)9WGNCRJcEORR}H&_r63STKo0lM_Xg*|tfg z!K%n)4w&TU-C?4Dl66(1f`RG2@=Ol|+{8broSh`rqZ}02%72TEzK1(Vmur}+aQpwuwn@VV)&fopd3-P9s2s%lqvq;oowvKMF4$|oa zo!r(n3M?A%{T`jugF)|muib(H76x_v6Iqv7m&F4`q&t)ZBEwN+i72wv7FlMnb4X-4 zh~({{r%phLY+u_A>jrvv{Is+W0xnWHiJc1~j*1uqMWhuO4kF1YvO*L&&lc%6*h&&P zA4IZlf2JPSSK>;)_F&MvXZLL;1YE>FnOz`O(uyR5ND7KvB#K;Yi>xx(B_y&M zL{gjQ(fUf%Ut9ZNeGn0^6#o=td~(%5D^|k(&mJNUxDp5J^Lkn?;dZY>`_Hb{mP@4kAet%KC79C6RB4uZJ9R=_9n?}!mDNZPK9K6Ypo=$AJ+#nyfWBYzXdYk268UjERm63 zx;Y?|i!yJEGFxn!cMP_bWZnfC=&NC6tc=xHE0VtYJ+U(HOJtDD#0R^Pw&C zk-R+^ocUx+A`Y>_8rN54>G*LHhF`s zNE+-P#LDcD$PB6s_Sgj=GXiCHiZVaiGCvt?7s>n#GQ7t&d5^6~dhB1s%KR#kkyd5| z$P}W?Z=%d@TjqCz?ID>zK!&&3CU3KqgmwF2m%`iRhcHB5Lg^yhwLFbcPpbM;|3!ygWgJF%?g z_JC9|Na;}k30`_Mrs3~h^cXlY^jH{4Fb;!&lD%ZBiC$*h%;yvge0w$??}2~|`X}n~ zn8$fH)Dv)Ku%L7ci$Smi1ziA%f{BwS zbVI-et0w9xn8*1b)7>~TSWtSwmw@0%6ifw36imZ3VZn4bGV}}>NiY)w`0H{9Jyio{ zWZ+TI0>NLCPg5L%m6P-=%p+`ZHqJ-{Wm`NF1WQpc2Ov=}7t@3V^WezP^I;^x0t}!_ z)E_4=GrGo&UeHOG?eajtE9jrBkH9>_78l~oU_t2?mxACZ6f6Qr6!c)4uwXG98F~qf zBsda-fD-jXJ$d!+Up2-AuYhm&*r;v@xM0;}y%h5ZTRaM91`A5JcoYbhp;=JA2T}Oy0W@euChB@1GtBxS)TEJ{I!`6&!~%g9W7(ECa!E z6g&hVQE)t_2@4(yM}~eFj3hV#gMjbgp?TftWu`9P)PsQ%@zDVV0u;nv&p&0hJ`ocM zhLdn+h=%20=taZH0EvcEFiqHSDjXU5G#JV7a15Z$;WxrGtNHRBY+ciB8PcB$Q}yYX zM-V&$XND-~1;NoMcqBlg;8BXCvUncZ7Fg zIO*{)S*-_PH1rc-1o2vZCI*mnSa2bwiiA{=3#I%l;#J~L?r z*5czFe5{;5i}*U?>p9;*JiOL(@Nsg!k@zO!n>imOK2D8y@bPkfKJg2P*Eru|@d*w- zLC!BE{%qn~Ip0Qng5d9x^Xu1aPyNJJ=_+)WM~Q!o_{TZ_gvIAM*3Xyo>xqAo_zj$YiugP= z-@zBi`HjRsP5d*Qf7ap)9Q+75{~Ynp6aNC|UnD+XEpqUMa{eXadxIes4 zBhFKT^(rK>UZqf5iEZE#B+kOXd70#D7ZsXPp0>_+quh;_?1JO3r^l z{FlUk#rdx-exzglGCBVZ@!N>+I$aL)W{ zEilUoO?|MXwM}cUZwqQp=5W{7tAXY@^G7rX8v;$O&dDtefq8)jCyT1DuC8luY-($4 zsjhYg>t+Y)+ng-Atc}G~uvneNxhvxw4o4&I&*IA}6Jet{*c7O5ZwjykH8QYss@dse zi7MiKDwwk}7WS@f3pTU9RjeO(aF#-klO+wSV97e`AD*B-7}OeAN);R6_J_7_deIA{ z-&+`5W?SmRj<}Iwy;4oR4L0Mwly%Tk!7n{l`#O#ZMcNx_&xt@ z*T>ZF`$wY)D4YUl(~Ph~44D zAfTp_WBJHwtXNH_LCRT)8aZya3dgAqQnOSz92E}Z$n^ak0IJ}whK<#H2;-G#6|9Dd zR>!CjpW!+?mVAx_pTm_YH82P)PWe|}3_N>RrguOP@fkIZjZo87o5}ILGKmJ07&JLS zG#P1`jMCX?G8yCcdmY1Zfx*OOns}qaJ>0}MwuFr}Gvj09tjwI)-RJMoqrEVcn3)*x ziAA52M4$1N&&fJFg?vtR`#p!kdGLD+)*a|XG0$&nrguTWeagY-G%+*(>uw@lqgXJB zLlci^;k;5oc}vjIUQCt#w8IXSbti8LqiV3L3)Q$>?9 z%cNXq)5v5xTc2_C!KHwC4fmHn#>SQ z&bCa>(b>6VQVAw0;p^A$%{l82gG{;>w_(6d%E9D3F(>DDH<9Kf5ls4^$pxaxg_cQ` z&MqR8YFHifw(9q0H=OSxll|cfft&b7m9QEyC$-&8dgR0fIq3r?PBf_#P3kR^2Au`S zWG0yWxAf626!2!$ly+d?Sy(p}dm<(yOV}*YMD3M{6HNM|Nuy{o+cLRWXH8_%3?>`K zSGq``OIsBVY$kZaDI3XJ%$rIX3tBgoIo)-Rgr6GXO{FjB^g|sc>S&futIpa;ryX>D zPhZeQIzPAE-9f>dt0#3rfQdmJ-zYX$%*!R+MWid#4@8nsWS%H8-x67%vr9?jG7$O4 zwE?H~d!zY1<&CM^pd%tuHk#=mV#~99nu)Y(-eay5v2H*;nU zi6m}4)QLgpp+ir?XGFv|hFv3OAhMIiFy$l@+cgy*n%j|**BH@m~0 zk#Xz}QDkwiL{dOx0E*lxiY&22?$X)aByx}2Z#c|a#k22+d1MsY=38PHDI3S`70;3T zx{FB9kpUo*iXuxzk^3!?WjcF+L>`2U{QmF`ID9x+lh@BRFbHj5aj+8te$|wn$T~%l z<-HO~1(7rqc}Ns_*b;d}XOEJ|V<7VN&Vd~`zc;Pwcozntt*cxH1YE>-5?diI&Ewrg zq$g_{h@_*)6QanImdH~&dzwU^!K=o&n&$To*fRsB2a&bA3cDcSB4y**N--nPb{CN@ zO*)8VpvWpw^d7ZsLA}>Nlwr_fY<~Mk8AA+Zl5f)L?z#xs^QfIK2)XXVI;SY+~ zLMUPjv4}Nmaq+I20TKgIVznsovL&%bXKP8~6_9|UIxNA9Y6FVuny^HqsD2e>B1P;B zwoW1=eF_f*nM{;joMgU$%pBeLIOf4`@VYuAsjI&f zGxL>1Mw*!%kjX`vE>UK;CG)k;_K?gs;nEshK!%sr9w@D`hc6SB*58Vm`A#C!BQscC z=YmWg%Ip9_^4PIS)x)!(FWw5&bQOwK%iHtNec_5RIGCzqj2Q8VO zb#{nket~7;1-8KpY>%YC{#DG(ZxWdvnZX)6A7loj%wbXHcT46EogE>WKSAcdrH^4A z{06VFLksIF?3wXFjs2G>^LKA$27`1Q{FD({_;cqy!IM~v)cxXv50RzA1 zK=D4*@f(Q;7I`u7T-9;|_V8z>ZU|$?2BG?bM zbS(*55=_Rx?{%bKiaLHH_F(u$S!hG}cN7;aAEoujaqJH=Ed_ge3QAA-LJ%B+f&%~& z1ygaDh+rCQ=~_CpB$$DLKeXk*ZDGOa)ss5V)Dyala>@nEMr#9MS8<6mu}2~(`#m)T z1dC8`5I~|}77h~;%!Vyp%Yl{zb20FTj*Rtq(aVUhDXk&FkH??W2>}=MjnVRO9ASy` zv8Sh?bcu^Va3~5621pci;V==w0@%{ELTE{F2nK#5X8GnW^fDZYBjFP=xO4M*?BRmt zW3(dJRb1ks*wa%`y2L|4uowl40TKmEaF~do8@6<97_=mK3e+K`o?!}N5#bv>;W*gRwG*Kw!;>)Z zhju5Q-2oncBR#3S3j@zq<4O$p8vDj+<8d58@MP@irJx%GhoRsp0EvR9;xH%}ez{&3 zY-!L=gT5;5f6%&ZulOgxS5D1?`@n}nDdom!!PUG0$L!bO~PIWyz+LqXGaD-9XcyCKeW1b2DBhvrA@{F28|BPrlF!> zsHoXeehTpl@n>>=s>#RN_-Hv_MtnK((>On!_!z~`$H@5#;?E*}2ItQ<`8eDBv2y+# z;?E@>-{{lvpGSP05^v+<UqJkYoUbzZ1REbO=Px3@n)n*d*Afpe^lW^BoUbFk zp7;jN2Z&El5^a2$ze}waontZ11_y@`P$B17+{NtQ|!sN4Te3qPllK7{Hf12~p5I;z<^VxEK zCGpP^zl!tEnS8cw{v0{~Jn=6O|03sKB0gKmvGKWbel_tg6TgP@YfV1a#^=fTSBQU= z_;s9rjrbg8u#L}`^XrKZ5pQt*b>efCJR3h)&c8wYo5XM6{97iUZ{uBZek1X36TgY` z?+~9a_!r3e&BVV;{1(o?NBm&LWt+cH&c9Fm2gHBK`HzTqDFrruh@9U_{5Il0=KLon z@3!$pa(+AUJBa_3^E-(zPzp^R@Bc&P{Aa}PBK~vEe_`@NZ1We(`7eq8iuf+h?Ya2$rsz^A13Gb5x<}KA31-3_+q8R w#vdc+e8?%2wp)%L1&r=$8j89eRS*_GwSFtzMwGZcTRRgyD!a4_UoD7{(t8?-92aH z@$BGmBqwj;@F$+lmBGR1UE&cSrC zCR~eSTM}DgMzHhRMP^|^id^U~q+uo!wC{mb|E4_5S~FrW_`^mVNG703G$)uXg1O&b`9Vj(L&X6$M0g*i$Cn^_O|m1#<&g0oR@ z7FX8&K7yozYNaexny|EpM%6Tzz|G8b3m@#f-nCmmIw&-6yA-8G$usmbUT>J%dSRZ@ zpiJ#BqN7%I+)7|RbF^SLjcT+oXXm_e=5U@_G|>@Q+5$W}8YlK~wY^@ML*WyR2OdsTgy&|y{`iwG=cjwR@r_3Mf#CI*G3 zee3axYsGnD0v4Jh(9r^SRMm$W9TwHmN}!E7+R-ud@+k~N$ISdW8XX+Fes*~j3(e7k zj*hDOu%N@LI+hYx#vFH|qiNQ$5{(ub55xpolsx-4`mxX)f%X=-Ysx-G@wu|1!=^fx z6S$i>R-j|{;k_(cn11}H5=P?_JlWBMj(e)=!-fvK>R3tOUgqdT$4!BQBQ#p@T}rW{ zWIuUz97igBw6%aRWgmX*!;TJ4b#xI}#T)^;R@?ufi9w+Oe`zsx-PY>IqT*<6f%~d* zaOiNTj@1P2XO18`8q2c|3LbT>#{S*VJgPeAW)W(I2h^861los*ngg#1s#sqTW@0`vk);OZ-gnM|l&|6rpx_1Qk;+ zlnWJZRk5DHqf8M-g|quYlqL(NXx9i+{B3j!SZIns2Rv5QLb*}lQ572qJkAswQDG`? z9l_44e;q9`#h;TGD%1geRdwM(g;!NPK_J2uQB-gTcVIAf;rijkI4#DmnP!Y)QR!kS z^jFn|7ZpBL5hD<1iUcaWr{}X|!KZCk|CLv)qF4rURSF*}>Wi`R$sEgO5-`vQoA?P| z2CHz81BHDRBqi8P;7MMw^g)Uj4PuSV&RIPC@mx-eMtr9m$|rh3&dFKGhz6X$fmh1+ zXC)XUfQJs=pQHC1WhITLBt0p0XkLN>fg(eg=Sza`Y7A@7RN1v16c>*smbSFiv8fwv_yCis#z;1@_ z;YHm3G}Nj`Uy|Tu0(%*{j~A_?O+#&ZbiV`#2)x43S1D@OP`e&|O@h}69AxMrUbNqs z0H;R}OYjDPBMg0$7dg?Pr8@NJTN1oY;3z}i;YEk&)KI4$Jtn~@f#VE)m!dumt<$6L zN$@^_4;cC(FFM6KiqeP7rAJRl@DYKN3_V3rmzL_*qaRD~34u=;`WY{}M7Nge(W9SB z@CAX>3_Zh(ZqcKqdiCg+5}YOQ6+_Qa)T^OBJ^Hl--w-&@&{L_}0ToMaqF8He$Q_!!1gp~uvCpD-^OQ&+1o0g9sGa3s?c zPxmClVL^|qP@`!9oNZ|+R=`EUEr#37@z?As5o!X*~hHPAIe1AhhC$0OeB^sGv}32%@^4ia}K;REu)%nDkP`=bVlbXK zG!H4tL^M{y1PT*H4HtecF8t{6IFh*VDSs`Mc;Nb4V1cUDaASKz2b`zX@s+iMUmK;3 z)^If%uHw|f69Y(UsMZXjHXcI{ahj${6ee@i`Di*Bs_H@-x2XL)i3Ne4!`M;ii{D<5p1ak5gnt4*YS5#lZ3O*uA>+o zF4HlU!bRLMO_T$_8mpG2Nr!$OWU|0-`xg#jU^&{+adAO)xX|G?9hXp;&K)zb4)~urL5J6Lv{0DI9kZ|w@3y^umRg#)=6i_+*<9;-7Fdp8Q$1WZVjY8cuDs|d zF&(ohT+SU=prgt-ud+0L(H}YP7}}C%f#qmN$CU-uQG$+A({UArtGOe9du2AWERBmT z@pH!s&#|vgL%W713(o!;L)1t}{-6B?>mef`V!(Lq)l%Xrs{16&g~B4PSd5RXPpmd{nu_cPy*q}6DcYLg z22_l^Q5C4DG!-{exQQ!5sQ7(Da1ay9l4og)#DeTm;}~021e@XJf;OrW6;-BU358p@ z;#N`46|X#;W0?bIv=k4r$5wxd1Nn_=YlhB(s;ELmwW(N2AJ@*6c1)PfW>sHn|E zjGH;4Cu6Xz6PAm^-VEm8pa2?wE9g;R1%=y0&C>~SkvK?^%I{gc{PA8+5GVF@opGb5 z)s(73k~nbv4pB4a>k9Nzz)J_`r`UX_swME2WH+S^?NcC4A;Zy?40Tzk(~hoEU^Rt) zj;;|&F>zaHu^qi#fjcNrj^4@8d{&noy-R@s3U_n#9+9|-$I9xqqiYpdN8w(M-p5d{ zg?jAh{R%ulVLeA56bU~5EYxd9Hz@EBg@-x%h)BGo#6nB#=tc!LQP|AUM;Tgbp`~_o zivo{Pc$}k8h@|xY1qgQZNd=yw@H9uC5s5&2R#u-K-KxN|6t;2nIg$8CnT3|w(dQKy zq_CZ%FEF&mLd)&w4h3GMu#=-NiKL8_Gn5^&3Ol+>ftM+~!qHb5T480aw4<*n@H&Mz zIJ#RT6{OP2T4hJyRA3KY|2B$cGf%35tl-&SBBg?BjmE<>v=w8oCUr@(#+2RM3A mB-O?au(E0mR1MW)FI(^F;og+qtESRDY9GAc35PO~>Hh&7+hrpF literal 0 HcmV?d00001 diff --git a/data/chempy/fragments/ctp_gtpA.pkl b/data/chempy/fragments/ctp_gtpA.pkl new file mode 100644 index 0000000000000000000000000000000000000000..dd25d6be2d0108d662600a2642fb427d0132eece GIT binary patch literal 9123 zcma)?cYGAp7J$>sCZxAb-4v1_h>}ok8CZ3N(F9|QN=RLpV3Ord5(RZISis&vu@P*D zT|`t=vMM4X_JR$G1+gRIdryQ1o^y8Y&fMhw5&pPy=4QTozd3ix+4<4Z;+wy)LHEve zK-1#u?CREgTDpC@gN2m0v}oRr`3uK(_*%W~U5@FUt=0Fp>uhLn z_?qW=Te=-Ath$?p*RlwMMV8k^hJ=K);qff0x-JHGI(+TkmY#Mmi`IezJ5Dn@9V|ve zJhqlO>LTFirfy#ci>qhx+`%ywdK_%Ts9Kg_u*ARwEk2*#%983?a=Ax|Ssdj8(xbTI zxA`&fCtZ7dF9cp1v9qbe%Tnq>p<^aXt&4(f*TRlwUpq_FQt1fY+tta^>%!nKC%Rci zT^t0^*VfS4)6wkJS*99Fr`4i0wRN&A8fq$Y65HjS+s3jrXI(fz7q(u+ay(TBw~+@; zrFpxXx;t2|ImDdyrny}#Z$@uOh>Ip{Yi0Rrh!zEZPl6E|@cbL*>%RG3y}QlZ#R?4O zqBOR4HZ{!g=^d<4b9VJKYnYHCgB6!+kcJXSL+qAy3XI@U3fG_1hk-wR&YVUFyjlv` z)r_0TMrvuKU&BhZ;2D=`aE4lz=G5RsG&q63PyeMCKn<+5fUA}dVU!xCfls;UGs^Ng z!eFDxXH2=L>d@3{6d1&#D-Z`y8mORDcvS6AnHR=rc+5 znQZw?G1xKWb1e8IFJJ0{K_D|P)=}V3jGyj@p5RJ>&v9aAjvs6yU84vviA0kVM3XAZ zL^0S@GMNS@**lMIgn2zm&W&fo7S_m-)T}_jP2A(lm>W!NIXQ8#i8LpXU=oEUCy6E} zTP7ZZokAwl!Nj@uQJ5A?oL%ctz|((d-IPWMxJeC|%n);;4mOeIBnnKT(d1Oo;0}rglNdBPLo_+l zGC9j&XOqb}V3K#o4J4psuG;Dc0l1?@lNvCo6LWIzU=wLhV!$L8P0kZd&bLfv8LXa6 zW`jw-ds#0EC@H(!De%XxIWPb{!JJf-u?8_Gje|{wtF}KhEn>(xAnl|4__07X(3*ab;|dXfk(LCJr!(LlaFjX|qh`8SDZwX$O;xKn6TY zlDRtl|D2cGXPV%rigI!G`*MLa;^bL(TzY@_n zwUhbIrF(bDQ7Li`8Ng$GpBDaYmw_76147Qv^?f?H!S;4@PA5 zK@iNy1a_yGkrjhQq!~#DkrWiUOBA`=61m4<_maqcAd>t{Db25>@Yl}az#0WbCbE^H zNZ+tTQa~gXMOKL-_gf+l80TMg`@(7qylo76D)JF zkbDA^f`yxhJsDI25mQEb6Q_YpI?6mH$~yjv0V}X9f$&m+Y5|hrKM3kzTqP zAd`tQuZS`mEt!6U`AOzgymXf@g_$ukW)-POs>s*G%)BmNcGD9+h6=gQa&Y$nc`l&x=YWcFjRprQkBTp{U#?X66Tp%#h4rU6~6qc__16 zl=;z;`N?2Elgux;OpEsWVQP;*_3+^V462~6R3PBjj2r68UqzYUhAWc?GWjU;yC}2A zlKI16dr9U`kV$)GelI%o50w7}Taeitk&gk&n5E@Da0yl}9`={SMf$4F2bThL`H$%G zU(4lx2K$>__JfOaSECCR`uA*)MFmgQdmAssfV)6l`Hz^F0}>bMA{Bs(3tbM1F8{Y& z4jJq)y67RHAt9iX=fA>*7X5EJCZmO?e@oIV47g5pg&qor3fa-au!p}iZEq-9b>{-9 zLXgtK0TR6Q2poogebFOf&(NcwCBbM6;6h689Y8OC=*o=>235PWSHad2tkh%RP*E@z zdxj}k2!cf@=m1C*jKg7qg7L6t=p&#d!2}H8CANA`FM9c-GnNcsP_=jGaj*>vy2tB@ zaHz1RdJ^^w6_hS(5eOEeU@}0WUBU&(L$ACBa+_;0Iq};OBV%zWnEVLCjP2 z?d(Z{;6yzS#}Necv1gcqB_KEw1q%QY1zk8yP_Pj847~_i5-i35egbyCte{u_uF@aT z%Tu-EmUayIO;R&aFTru_HJm;Ydxi>1pYIW2n?WX za&77b9gjb5y92f$xZk~O00J&pJxL#p=@SxDtDY3QBL1G7v0B!SMiz zf)j9JQg5P@HiX>1p{B$n|+@RJEVMGaL|*XvsU*& zYv`vy3*z;^>rFn|#z)Ed z*~B*x-^lqU;^Et#jgOY|&BV75-^zI}@zH9GjgOJ@bBLcyyvF%9laICWv2uPM@fQ%^ z&iM}FV+DVQobM#wNBn%wGvXa;oNfL%Ij zKSuoHoPWaPvu%8~oPUz|r-*-=^Uo0PRP$_nj+|dh{IkTbhal z@%d_jjd#iU&BVV+{1(o?W%4C9zEI9@CH`&Vw{iX*;tN!ljW3e(?-KtW@$Yl~1CuW_ zdA$FN<@|@le??e~Fy`l=$t$f5!RGi7!%%ZS#+m^Is7ECGlTzeuv51 z*RNF0e@*;O;s-eY4e`aQJ^y8L{#)X|BmR5N?=tyP+xeHv`5%biP5h6X|B3h#b)@b5 zN6Go0iT{Q8UpfC9@ug~+jXy%p|4#fK;{V|MUgFDy>wk2R_tvFCsm}jrjP3t>=zjuN LukVAlr+MtZYqS*R literal 0 HcmV?d00001 diff --git a/data/chempy/fragments/ctp_gtpB.pkl b/data/chempy/fragments/ctp_gtpB.pkl new file mode 100644 index 0000000000000000000000000000000000000000..ba83fe533a8dc23a43cfe5d5dd2c0c21eb8aa699 GIT binary patch literal 9123 zcma)?cYGAZ7r-w)TtY}Cg(O@;AcrVQXkz)@!J#XxBoJFHA*38^Vv@^j5(IQLDi*9L zHbgYoup%ldD0*u{R73?u5lavi6|tk(;P>9Uo7uhZ9 zXl$*iaR%y|{Pi797G2)KVk%jz!Q$LiaSn&05wBe(^BP&6mRl7A(ENrA*bv3@ z@0KkloY7F4zoWLJh2@94nA==CubmZ4?{YX?G+<)`D^wj?Jp4Tsm>RtQnl?Sq=GQwK z{q1b1!CaKahSu7exdFX}718)pSaEx2orY-{X0Q^s2FVx>$=JTP8Ty7~l>9y0OF`^M zP7M57IyqL1naM_Inbb)IE7cI-7k}9Fo{8v zV?>iNmPwhx#*)c6x8ik-!U+ZwSJ=cG6>8xozVW4Od^j^cHo?lw#NIytj2-KRuEfm5 zfKM#?94q=vvV4v+*zx3Zf?M(Y63T<(E!w!h8^t`oubQ zsW#YbGO2;t2`{UPH?QFw7n$q}y$IaIS60gAh&ie4ZPF(vF38CMFma+uooG^TnKT&8 zPbPE0n5d&$ zI_(DQAe~Oo`C;9pIWVZ=O?>4>3WAG6&o9^Um9hC^UM}b@BAuaR5E+Of3q+BHmdGN5 zT}UDq;c6TD@_@x9^x7z%*FHPi1!`QRqKp~hLwj*=5$Qua5JXZ?^K+wSYJiIk6Ji$TOTHCOZzkxfkshzvrJD@Bp3ERm}XwuD5k0g*qh z^>xFriZ_1tcrOOQ?V%T%XT&#-T`Nw_b-hKTQ!@xeQc>i3QRD_orh-TsirgZK+-iy3X0Y2y_S zM9Tn!48DLUY_*m>{V@E4lC2m@wqh*V!j-4EhGc+5CQ3XcN<3^yJYuj%N#Ze(*uJ+V zB*9Ba6H3UgkVK?}d>mvVC7Z(5NMxk1ZzjlOq0AGa%vww4NrOE_GEajH)Q>ncWF%a* z1^2GW5@eu$Tqnvr(_fh^kQt0J&x$h7Su*Plwt-}x$3-n%LYlmUG@*oafgV05_yYh- z$QSGnio!NZWTX%6V35g1nHNQwmn@l}!Az2Q8J2opKbpLL4F0~p(k_Gb<11ojUX{p5 zrzsm`a!}?qQRa0^W|P6*AeqgO87LvWaQ}+QOUR(4gnU!X%v%x}X=ZXjCKqMi7G<_r zGVd5{E6KbInK``aA zGNol-X^`d}**fB=Z$a6E7!CUQT)><>c35X1!!KTocBzJ*|@^3LO|43Y!tZ(M5N_1`a&IF6R{ur^yvez zrJsUDAXtooPJl$gB4UHz z+wXlvPsNtLg3@U%2Ekz{m{_S!9AlKUFc=TEnhwd1JCAJ z-+L*9)IDA&3Z0&%H=G&z zNH~(<5g5R4q1{kSftQ)mvC)NrXUFOvG2nvb6ZKKpkMNQli7gUA*{`z^AXtimM*$=X zj>c{xf=9!dp&tWB5*&j8JcA8qgAE8~%-Gh0foI!$U%4RQg1%$*GVDi~;<4D$S5W$r zl!Ble1;+s-3XaEaB7zg(%+M#okpz#$0QVghgAEAseFx8mT}9Z!1Q}^KYu+6V~A*j?R z!_m;E(53O!x(@@@p+@;>mmPNY{klFC8eyZkP(3oVW8dM|{Q>GWi1 ztke}a8u}@41o3Kp8V1m5w7-eEih{19nxy=6;#J~L<@}5=A8X^I<$O8u6~xcv{4C;Q zR68Fd=PQXnjrh|!e@2*(vyC4s=g%bmEaGunpYH!`;^WkK8y_d<&msO?;?LuJb(l}E z@$qtgHt{vY&*6M6@vy6B;}hh39r5+VH*nrhe1e*2;}hllT;k^uuW`OH%nz{f1LS-Y z@#hoY%=s4L2MGR7Ip0crfcQ4fGvb|Ul5PAXIj7|04f83s@dwHI%ZR_6_{E&R zg7_45kZt@_Ie#VbR}p_T=a&#aNKLhkpC;$8A^uw8ujBmnVLr{qr_1>ph`*8erJTQs z_%xO0AM=+X=Wix{8S%Gp{#N2M)J)s`XUh58h`*iqJ2<~Q%xBsBv*i4p#IGR!F3ztE z^Vv3ju$;e}_zeIeHc$4!l6JMaZZQ~D>^RE#9 zD)Fyz{&nID)uA@tCFeI0{|51!IsayuFR}4Oa{evi-zI(w=iecIsOqxu#d3Zt@$VA< z9_QZ=^F?7E-~VB9ejD-IiT{A}9}-`r7Td-zk@Gu<|A_dHIlq(mVs)5p{NZx`6XJIf z|0(A`3-k8*8zJXEC;kiKdpN(F_+hF&|D|&NOXBws{}t!I4)Y^y_wSbT-w?l-_-{G? z9q}dVaNGTll=I&czmNDIIKQ9x5o)Q8KSIv`Nc>O4|IGPch%XhM|4|X%UzGu+I{%+B Tw*T*;{|a2S{u>-S>qh?{cuFmS literal 0 HcmV?d00001 diff --git a/data/chempy/fragments/gtpA.pkl b/data/chempy/fragments/gtpA.pkl new file mode 100644 index 0000000000000000000000000000000000000000..33ff99320ee646a5ca869a0182d696a8e83de1bc GIT binary patch literal 3590 zcma)vdu@0`2$ z-rV~Ap|;Mtu+l8xhd&f-kAyq?kx*Cwlj!%WN}#QCTp-k_w6+Vgf{n^jrBQ$se_frg zqop;{60EBeLcT?cKO#VCRRq#xNT-k?dNWKWQw!t4T;gc z1;|p_;}#hNZ#vQqkx&4#Yr(45AWX**0dmI3kV_#iF7Ss!;YP64LcZvcvR0a%_@qa2 zT2IGV5VNhD)`fw>GX@(13KV!#aG(YXy=MGw?+o}ttzcIRIT2RcgHXf?4>-KpNZ?RQ zU9cnIQ^GKaqNVcbZ#xB2|erL;_HZ1nax0wV}BkhRp6VnVjBK9B65T z5@J%#B&EZrvKEF?7$&M%_;4)Ta$>K9kVhK1Z)P_OVnt0&^%y8>0XJ5c)xZeV&MT`1 zr&^>sRIEnDDz41^s|!gL)oNU*mSAWmshVjdg&Vl(M$zNCK7Fl(v_~4c{9-)|Vz#Ac z@w?YlUIU|4yE?EV6&-1s<0cBDxuX=jacHTf5vxb_aEEoz*uD;TWhsbSH*Ofyx0`Df z6%wNTyGcV+x@NkW!Y$l%E1L4Ru5lub-5l`pAeLvH6~mFlyrF4qQr)DZBSUkHqcEO3 zZbQeA->24NMvqjoVIF?tj0rZMgn{mGPbh^lbPU`_20F}|qnttocT7M>@#Wo^5FN$s z`&epE^!nZ@^%&@mYIIa4)rT1!nVMrFg-P5o8671L> z!ju8~=*HERiHn+;ImwhHYEVQ%i$(oQh#;T*v(#)##X(R3BOBuxO4uDY&>p zLdS6TmM)fBD!ACngP3L4wH_Qv^if_4(+BLsiG5hmA!v>n6x`f#7n`dUS6N1nWXDey zM6YL+IWb5$%1U8oQVszf*_z{S3Lfsb2OajqZQU%jt4I7N#)9av^ucU|IoOd=RR*)P zO;QE3`)-me@q?%TCdo#TRTB{k_j1u36ct~nmoS~jb?KbIgXozfi(@#Vi`?Z-6F&7oXVym2((BnET@blK=I?=mFcrWE3qhjDLa!`@0Dej|iKUX}!UP;kP zG~g>q*?y#p1<{M~1+8~cRRQyoQskl{Pg6Wd!OIm7p~A8AQa4v*I^xGl^m2Uf>k9V- zn4i={<)Ol+DITV4C&vr^jm@lM{w<@j<=C@NuLQVJU?@-;;rg?g@NK!t5& zeCxUX9=^YxEB;tmDPfRMOaxz2ihNWQXbL}tMy^m$kr_F}GrKN~{<8}+d!pwzt1QqJ z)f1r!6$Af<6riF|Q#4ahxuOLXR_D=fmRZWy7wy&l6IC?{7NKI`6;+4|yQX-ALMvAU z*t>{N3kD|-)-zZ1x^GSo26`9n$q-CxqU@+B(i9;IZCnAUaKuk0d@0&_82xwt(C$8p zswogos*562I68dsi;OQ6Y=rh&h=_eIQZsN+fDV3%S}em73QI-RTnn8dF_9F7UrX?= zgx8p5Boz<8!SM@FLze!Z%&p#>yrLclO{}_8dRZ*AWrGi~73}}}OD=9qA z(Nzph*U?lX`h*NmQdrH=H6lqP89JI~M4ysjEroR)eVU<(tm#Jd85!17*uc?^BFP|T zJ!^&$-6X?i3eR%%IfiEHsM&}!Yv zu^C991xEC!3|~_?#?j*<$tMMR0fk2NgbXJsoZ{#=tbjtj0J{-AEyK4IzT@Z_krWcU zp0&t`elNoh6n^CBPizJfFVLM%wS_}%N;uM@ Nw8O8p@LPv(-2W1`=#2mX literal 0 HcmV?d00001 diff --git a/data/chempy/fragments/gtpB.pkl b/data/chempy/fragments/gtpB.pkl new file mode 100644 index 0000000000000000000000000000000000000000..9458716ae2c6e44512faae28724b69edd88a3686 GIT binary patch literal 3590 zcma)z$(1Ui z;tLR8715$1J`oWW5N!lOL_h=u8GcxXQJi5IWkwVgALriP4Q2l{f4V1kzCGVLckkZ4 z4F;o4^J`=3ECK%nqmkx#tR)za#ssj5!Jwvwo8}J-M?-33voIkNQs=250n&oCwSks~ z#&|=dwpNG+W~;%t0O?h6$WS1Yf?f36Z8lp2H2sy47oLsXVxH8;D`YEgB5U6D9{DLXfzgr!Wt+N<&MLEDemV zPO!lH&kC&-1C?it)Q43l_NU>%Byjm1cx|2^4n!Nlt+_Z6Q=21D!U-9A_;ZoKp@!N> zOE{p$peIT5XW-bJ&|K&xd(ZFPo4{W@k*3D$<6*c23D)<_#`;;!(0gL5&F1l^<3K|Q z`VgDuAZaZDjkVC1LO)T%!uw<4hfX#kiG>gPYlg&w%p(E|RIQjBtA|g5OEovItQtI8 ziPl5IYBa3k+~iZONNT9obfMMCsNJmG8;kcZ_72HuO%93pe>lhs#!y%>VBc{VQvJ^z48y^hr+RfkPmvZ zue2=n4o&xP$0>cym=0fADO7aZhX?z}L5E;C#!>Kb$9Q!7yJ~GGOD&buRkX6eyF5_I zMv{)_wOu6^AcYRF#2(itf9}M}^Z+OrbE9D{jLs&i{GL!!k?h`j#$x zcN9n3am4JRsvM@Jq;R65z);*y!OspKkExo?l?Hq*;P?J3TC3B`)^1w zDqMzQ76pwf8nBDskIU^?vn)B|+gN7&xUc(#jhGWvH5z84qWcx)LWSE<+)bg8E5htq z82g9hsyu{=QE~9Vk9A!XzA+F$i!Te*Z!RD203Z{fpTB>8iE>4;AcSVL@9JxR1j9 z99_)NOcPDFq7Nvrgu;UyeMlr3#BQP)R`g*7mQr|xqmME)nKjdjKBmCq6rSMdGLhJc z!^~>8qRSOnLE%Y`u4HJIi8`$4Qwlsy;TeuTD-!%pm}r(2eNKTk3eR(Nl}NHkwuxq2 z(H9h0P2ok3zQoWR6V0)r?Fy`+@G?hV5lPO40t74issd{%yvEUWA`wW5nKjpnzOKL< z6yD_MTO!FNc_x}?Mc-E79SZ9?`mRXwNWO{YThR>)yhmXpN8e|tlc8*pIj!g>1wNqg zAxA$FiIWtVSqrS_W(BrT*viq5MN&Wt&8&r1bejU7Q23Oi9U>_tMP}9_E1FQ?GYZ=| zx`WL?5-ql(pDVDF!Y+<}A(A3eY!=|MqPrFNlENO2e#HuKnFYA5=w1c(QP|JXuSMb_ zZZm6%6+NK9Hxv$X^bnhYkbxH(b}r{I_E8%(CKgUb#yzXb+!2x_}UySytT2hrMJDKr@gDO z(cy2I>uc?Cu!!0o7CDPW87#V@J~}KctR274VruK-;Gomr;cM;f@Ud7eG_Yevu+zcf zG{oa)F-LtAe7m{F-^mghSR!|D)Ig7ejT$?PB^fL^FhQ%|ueY(329{dkRpOS!xPbI3 zuEcF724>3AWBVZR(TH8moj#UU9}XQeS$cg8e0DGFZ1H!n3@x3$q5HbKSY~|${N;Er z%c@U+0Q%Y+yLvlYd^*ck!|AkIwdVFNmP13;FekCyzB%nIS98`!0yMwv0+#1>@83oq zG?nJ-Y3}J{`N1J(cQnuGW(Cvx!oplMVS5`ZRKv6w_XI8XP_^XWb9zHU}z zFc+n&vO~2D&1N!TL?#hn5{V{*cW^&>*6M8}`1wO}!nK^c-iFA#kz$6+?juTDX zmWg7p8Zwy*Cb?f9-30S`mAqwVz$dJcBc(-wfSY(GmNO5S*m83GP!nlRqQN8vO->L^ zPP9zC20MvNrh$ob_aiVZm^i!Fp@4Vbz}hKI5O9+^FqtmqL>+1(%}ETH#G=W`qR9-) zq}E_{WHJ*>@^V+2D4=BB(4t^qrd)rn3j%K9sV--yh&h=x)MQvr`r!_W1(P^5IaM?{ z%`!RNU}uoYnP5_|;yMygvhRJv1Od3CMUy%(sTXr{)=(2^PU65M9!<^`P0q1Q&NWyA znVbhEg`VYoD4?Y6?4ZDmU%hV-dO|s=Drb#iPMU_A49kfNauN?F4m4>NO_HQJmef|V&fum}%et&h#XnT%@4)jy+*A@kClPh#i8{>E(GAv3 zIz6D{+|i`Kq+a)~PaG5syt8S(2|ZlLQ^k74yv!deB3+?G5E+Fc7l3>A@PWE6-bp~zxUBC$OiX@2*PvY+~3e(%8c8#N5LNZn+% z5=3k@O8-z1=?=Bk3TLfg%r!BC9QtM-28Ti9CkaNMIo#czr_?8Vww1nK1|f&xq$p_PDq-PYe~2 zUaT1)l8GWuiXu;0B2OD^4T(GhB3Xea3|uV1r{BOoXXp3ZL~5t7wPHq|9V#N-M>0Vq z3q{t6BF|YO&l_w#iEIE7_z{g zx?Vl(m5>sM1ZAX`Y&OW`pv-1b=2c5(i@{zanXQ2WA7+HS@B&|v6!@=;GH;AjCI@7k zDD$Q$v(1uu%V2Ml%sY6sEZV7%4Al5021??Z@q-ZX%wUcGF35x`Sr2h!DHmk&Q06mH=5tHt3xj=0 zGTT80YJ7!cc#W?>jqieYx$$Sqo&fTjA zNe0S%bbz0UYo{m>a2YJ~cZiw!K_Vl~Og_jIpv+ED=0{8BCxiV=GQWTfuk=k`=_`^- z|5q_Hze!|wE0SV=kC>VNNMxj$DFm4! zl=(}P`L8AOKZE^EGJ8RW*ZU@~_m%k7`(c$r%jAK2{~s|k`y?{MGJ_?55y-euX1^%& ze@o_o!49H~9tN*%aHSUSHDPwInSSu#AO>!z`V|QHW#g$V*Tdnvf|4GAJ$ys9c0Z|= z3#^L4N{<9c5YwY@82-{lkA@>dkAap9V=)!*Ohn zaE~63J;Md1kF8=5EI~mBK%!s*4igeggd;;A1uY3CVc=D=+ZUMVWyZQTH(}u3efu3Q z2)Ll9N>9dd>|3Osf<40pr5P*%!Oi8UIF7Kyh1eqzl+|jbAUFmEivSV@T{uiguo#XEy#!hk z9E|}y@uqE1(94W!s-eKWCn9kWdO}M)Q7^@Dge4w>J;Md1OFRYy%TTZkAW^U!hY1N* zz>%Skg_Z;l!N99TrL=$zl$85+-A#e}_Z7=bh`3@j;AA*5^dq1p!6Pw%%HruV6Lh?08h?HsY^uSYkl;0+lCx`CF@59@DU4dYh zUIVS6Po=NMH0T}-)G#&NM=#gmg}zVMkB3fp%Ur0A54@=F@##LleggJ}!AtM3in*ad zPlV1{x))kQKM7h8Z_uY<0E0&O=F(8%FjV+lDLeX+x!V~UMIer_#V#p5}%+Z+W15{KcDyu zh+n|@g+V^m#*dQo7ZSgS_=`Ai5TB@yvhhiBelhVE6W_=AB|$zZ$m6Y?EaxvF{!-#E z-Bj+C?eiiW#bAEM@ z&#~ptDd!&{{!!u|wB^Dhyfuexk}k(_^- z_*aPE%=uS|FHj3@yi3k+A^tVuw{rgVAYWwTi{<K${O81fLHw7T z-%fmqIy%VX{#_>Lzasu?;s-hZO^`3O&0j9(za{=V;=kwo4&qDIF}C?Dw7o48{srS|4C(*? literal 0 HcmV?d00001 diff --git a/data/chempy/fragments/gtp_ctpB.pkl b/data/chempy/fragments/gtp_ctpB.pkl new file mode 100644 index 0000000000000000000000000000000000000000..7d23aceaf102b20bd55a8a773cb54a32706060fa GIT binary patch literal 9114 zcma)?cYGAZ7r@iY1=2%$atVPPqG&>~|L)+>6;=`mmRLgS!3L8Yvq=!p)!4;~VnalO z4J)Fef}(deL`76U6tM(RQ4tXp#meu!cRRN`$@~F-%)Oo5cjmiqc4y!1hvsJgocZ;- zZSCQSf-Xi-_U)X9W1Lh3jQ)t zVMA(@Ab`Hs`i}1QCZEo-)kr$6X05TcgXPdr<5@1ToxWMEEKkd=jRt6L%Y`goasRV% zV-SvLD$Uo`*wxMo%pqpBHO}f}g_CeWsbpITm-qq^s zWW@$^QW{%28tZ5J^>$W5^G{%*9;E@F&{fH z@M-DfSY0ud4c9VhkZM-0h0oii!Fg&qTCN7Cqrqt$oVKS2Kn>irkg-+-VVoMJfz=4n z>Ig0DGtyv3lFw1#bD%c00S1A^ss7S~fqVDL%pM5BK9y71C@oX7nH+ssCQ)D#jV8y4 zCKZ-RrNKs%$rzX7i5Q6s3?@#~#1k3n;U?a($`O;@%(1gW@S!x3?F?+`p}v)&~LisRo~u#mxM#zln5>V!$L8 zP28f1$1)jjunA=1h0Mfm+U`UFPr;-Y8!&Jm5ZA~%rkqU#6I)JB>2D&Ef6KPHoz$6h(&J#_}w@m5` zHiJy+VRg)HRq^Dtoa-c$J)s+cn|LeBS%a99#{MP)a^i%XB!YYMO#QVUvn-HcK?o4$H&=CP`@0Dw@o;OfE238=16&$$Ojk z_maTQo7N!D(1H~l{x)&4u+l@;--=WI)hM$i8{Ka(`m3S z(&+}BgQ1I5asNDHtOsUS-0Nd>$UISGz9q82U>A|d z#cU6uHR~x!GWgNaPlHB=6!6!r0K2 zssuKKp7ddnvFuh+Wbt8%q=HBqirglO+-`~7VX!+%%O=T6X8A(S`j7iX3?4k zdq&2wC8EgPhb58*BIziyR1~?#5?N-jdr9OzmlBM~To4lZE_4qnfz3xH+eNC!v0f0d z)hNsRi%56abP&lvk^4oF2P}~X4fYU;JPaB6eW%h3=dXB@yVl|SP~5KAhdq30s*YtV zK*V;}JTgE;wvS|hNG6IrDvCU2i9BwwCrIQ;yhh9&-jgw93rr6pn?Lxb!6xE8j;$1z z=BfT7(u*|{M6yt1l_>JGCGw2Ho+Xjhc-I84aN_))v|VSwCy1=wQQ8MVI3vfi=fsRW z-(N(!k7R+!5EOYq6j@`5tTot+B=Qnu1b$`E{6YRJBLI)XU`RyE0D}y^w|m(-Eqn4I z_y^T=DOA&?SWTNh3dHSw2uNh3#LJ?@E0#pSU_p|26(pd#4@vOqJ_yx)Lr5ZA-Mt!EG zWTY2uF39Ae%w|z$izTzwU>}jpHn?b^wC^PuUfKtKTT^3~!P5R?F*Bb?WTeZK2Qv96 zvt5+=)RNg@u+K>5bI1%-_a2hr)qOxx-G3ow=1Yl;G&A`iQ-CskqRdW9<|~8kBAKrt zGl$kcf_YGayuc4g3jA-x%zP`6k!GdmS9;?3Kt2$PAYGg&z?}@Yfr9EF2kn9JFK@j{!ZWddQGJr`&6)?zEm$6?y`WV|#de^+fC$C@6hk zm4IL=3OWE11(R@?u;3s#GW5aFl3+3hiu=daCt$*qAe5gT4BS^P*or;;LF%p4Q*a#n z7OAIV&p<(G21`M3C<>+lBnqbEFk!(AI5PB1Xh|>&1K7c*?Fph+FxLDH6L{nEQGGVS z>PmeGj$?ni>DkybP*8do3_u>%BcB z7&l|A69e~_>A&|vzy-Zy^fDYrSmI&WGf+^v#KS;vI0_C2NE9r`VZwqgI5PAR(30R0 z7%0K$xf>eLD{x5D;S&V6&)d=q0T-+qqmRUKgq!3@>=`I1y-9|HU^xmN1&}B>3Wo^` z9t}r^ehjoESb>2O_;cT~9`p+G-PpZ-;W(#F&^uPI#BqcSj>evWg3=6@gP;oq#{eV> zj>TcZg5%)G(2s?d1dqc&3G{9KHzb%DlS6@f^Qz)LyWlwecpOI%JOO(SQ_uy1BT(=} zfJDKQa2ON}y;yJZceLmyLtmZ#KWJUH*ZULTPY&IU--oyRx(9+9eLS>=K7qa(SEqY1 zP$SexAH7_M7y3S3p9r1sez{0JGW4Rp%cuMN`YG5O0k69wT(iT2o(i2cx&p1Cp9U?6 z*XffmfI*{tvuUVE7%FnMl%GtzO8n`ZpJMVcHa<$uR}o)L{8Y|QBR*QS^U-p?hWP2k zpTYSvO+MB(e~g?zi}9L_W19cq?s{vXE7w5Z)Pf`cj_(5`hF7X!)_ zh`)&Vi#cx)KS&*HhcK(@i{tn{rB>pbWFCjinO}CwYmYlzv_@%_(!}(>zXQ-Jreu$jEm-zdL z@8$e*;xmQoKU>b%_mo`8SC#REuo9 zQ_im^{w?A+aQ8ey_=w+xR2o{7=O1BmQU3?b!|7{}A5O_NQUCh38+908FoB495R5xWp^Eo%=}#E8_SNw#b;N1q%V;)}%t z1msWzyeZzGA|j&Tk$BB84&x{ND5H+!FpM)OO!0Z&?3S`$nlITW@BH@vd!IME z?{323MF09gQdz~}M>r8rrIVR(I+5hS#D~MG66;?-JC=wj(G=Gfk0|Su2nR*sKp>Rq zi>CYHfdH2XtyaQm4vIU{V3whTKq>DpHJMC(lm|8`R!1+s%?nx(NVDAQpJ_l|gj&M*uLk1^-io774NF*cR>IOG23f4^)FP9^o9wLTU~M4?KpWJFR)#i5!J%b><@M*@fX0`W{N zq$FXSROC0~*qX>%xJGQfbcR`2kgBA6(lHp11ns*w+OsMJwMzy}Ca=F32l^sVCz(`> zRFny+w1o)-Ch{syd=gIFcKW!0kSI(!v3QUcx$55DAQp=1VaCpeE|{!Vv6*#(SFKiS zRGf{9v$(MI&jBP=RI7QRT8E`YD%MO>2ux+BYk9GCc;Qw7X;GN4;cSo=IoG-$@p#45 z*ag$nDs^l}F*?ke<2nMNJVbvVB5SYwX>{v9k@7bhs6asICR)G#~lPj=C~6bHThYKf=gSg?0+jJ3~CO#Wpp$^n|70Qz>?87$%XvJ zbM;MPN0CDlNd)dQevgh)<3~h#re2vgiP%jQtlxvDk0$oh8 zl&;q=?L#zKF#j}_71=*pS_g1MS9CUlT+q*6jtZxyxSPN-rnm+)g|8V_6tqwk zsBmeD`w6UMif&Yxe+>#Wx%JYPnRvu5{+>yHf)Pb$GdxhxLb*`k))WB(L8j>)deXkQBjo%<=+89iFgDa z?1m^m>K$Ye4ssAN+q*RRiMs@z(A+02p1f(Pr z&fmnV`Sa5Y(Uq^u%5s}4BbG{5*;lzq7TbJ2yA5NBfMmm zN_Et1LK(J~{tTZX3zJj2jEyi_Jxb<}D^pOs-Rfqe|!Pf?qW+KlLPGCWV< z1%|%JOSUT$;Ed=?GQ3RS6^0(*B~G&IsdgheD8oSluQK#CUb0IL9d#Jd*JXHvz?%$x zi=ve}T5d$&mf;YA!wh|gmmE?#Md?N6G@|dy@E(C941J%XPCd24h#r;U0|Lhw`XMhl zr3xK&8PVf1d_>>`LqF!F3dyBUz->f7k>MnPQw;r-qHaCaV?;lb;d26CFf_|cZpovg xl}0ot!l literal 0 HcmV?d00001 diff --git a/data/chempy/fragments/ttpB.pkl b/data/chempy/fragments/ttpB.pkl new file mode 100644 index 0000000000000000000000000000000000000000..2df8e6660c03a166dd3c72d2ed2877fa2f2de1a5 GIT binary patch literal 3264 zcma)HcWc={&7b7t&Uepu&fUGc zH<3uPZy=PCmvZh5SI)ulOt&k%pGYcmB2#4$_K3`lc|^TVCx7v@JBoulOvg!40dHGG1smQa^O(t z^fC#!patokbTSU*T~MLdz_sBB2bEJKs3K6U3L?p5DhkdnsNwy&Z@<_p;7q?zpWL3O zf%or?N)`i|WlZ$MWvC67;6Nw1f;Rl_ABcyOF>os`Mx^Ba1k^EN0gMWkBY{J`p+qJg zmQyfVED4t4*z)KKxWMoI>*&!u{$hy~Io*?v!-YuDzL&&$miEJ#xmlCR6Ex#MZxqIg zCdDR}WWow@cIFRC8QHU@~(w@P5HGm3E8{kLD0c)Dhj`Yi$5t>&6FDhIjL4bF+YR&+n!b zO%}~`DS@fXbQ$mW{;byS7bYG$Gf0)*U-!=|V4#}H(FmBGlZW?&cp1)$gmIi1<$H;wH(P7gZO$3^mqXql;_w!u^npzk=Yug|Vyk~bD z$zw3o2Rd4d>cfT(yXKfq;40?08vC$s-{YaFh4HJ73pB{(+t$-ScleqcV8)1j4C38o zM~6dmTtnbm=C}?WPW7(!3uEX1mS>K_rZf$7M*tny7uAOY9c7y11_EB@5OA%uE$tV^ zL>GCOy126Un53)0ux z4oix1)S|GjuVg!?L0jE>yTPVf73UP9~yo zXBWiyVP}w;ILJYqoj(#1BnkBKimeNP7foV`%--mD%)k>sN;KnhqfR|Lq~(;HgnrS4 z^_zG_ou8HL!akGPAu26mK)JQ33d>8fuS$*V!2qMqZLNNcL?lZ=)1gF zC06UG(}?bs;5`ES82UahR*O!(fEpvZUxEV!4l?uuiq_~^YmMk32|gt75kqslSR>Zz xsLP1vCHR=YCk*|RqHM9~3b<8N4!Usv>wg|XeW_%hoJ#k~{cyMoKFfrs{RhXAlBxgz literal 0 HcmV?d00001 diff --git a/data/chempy/fragments/ttp_atpA.pkl b/data/chempy/fragments/ttp_atpA.pkl new file mode 100644 index 0000000000000000000000000000000000000000..d51e3705057b146ee032c6fdf99c0a1fdf0bc3d8 GIT binary patch literal 9121 zcma)?d0Z9M7r;UG2eR**k43;V3lPmV24D5kNif^UBG!k40na;tOEpHT*}iJ4(w;3= zW|nPCyP4U(FOrpJo0-3UX8P0LIfuD#=ED60{ehRjyZyS01(h^6Yrc;8izjyYTYT+ZuIZgEzD2$k7YlB#uW#yUYwvFBtgmx@VEP#d)j?0LJJJ+nrU^qSfqw{ z)NJOe4TYl{yZs$3x{k$g2UivJxY+1%vstXc;sz&Z_WSh~7GK8_O1w(sCE;!$y^1?# zvx$KjfAw*_5cp`s&c+TOORNosj#(_JHXOEHi#wY9?JQYKq9b%)S0_uU9RNX*Fw&ZJjKghN@y2#CG}Swy{htqc#Mf1uY9%mbdc2X7Zq^ zG+%dPcL&S1hG=bXoZH26X7mOHxoN_-7M809Y2onuco?A`&%b`Y?w{||yW4zSY>dI& zl*X3M#`;#j-of&;jIN$04HJ@Yu!0f|(ohI#h}yVLff2k)-ue^!FfdbETN@zoX^CW4 zQ#y-{)sjiSh81anGcMNP47GGELxU61-~|3T_19hiHL%tOUA0^Y!_`q5_>_n~<7}V9 z3^ty8CX{$94^}NxU=Xj8ec_G<49xgNpTgGmDVxO(*OE1d$;1(vi~^GoG&w>vInp*M zHCP#$ltX4xEdgcBm4yRj60`Pjr-`Scm`$=W<6#wcW+o5y*;0Nu_O~ z7_5p+rh!T3)?*rAUayjM{h6?ZHFCu_DG+cI&!l4J0TV|~P8ez;%}E%TgrmucqRC0N ziPvB!lgV^2$=LlUObaF%UF%W6+kbG~)CLH+Ne!6H5ObmqHIe2d984n6c0B$ysq72`FjzZZbgt?r71Z225(joSZ$>M4FRGFo{BwIikrqw#m5$t0R;1 zz$DjmTQ3SIi96aUFr!xQAAp`fPRfc|y_l1Rp(ev};)a|=fr$%E8by;P+oaiGEo9=u z)mgF+=k+Sd&|=VkFtXGQLBOQ6n6-)~b4O(20+VPo(L|Fr+hm@>&L@+0Fi9QEfLDpP zR;T~pIoW-d3BF6JOIe5YP^o5}_Cv)#ROg?;_l5XSi3Xh*)R`~pFk44ASQqJZgHGDQ zEdwyASBaSZLIVcAUYl(8N$FAIi>NLMHZL`I{?LQ!OqEwb2P7m&z>xI)`z z4&eMs$k+K4^#4*(*$X{fq^68rBwn<}P!Z`xI~qh{QDliIa zS3+y!8%ShN(av57xQJ&GyINeDYlezQmnIHG;!)&UQRF&XuGgGvgjJSnO?Wve`Gu(hP}45&a!JE#IBZ7(`0 zP|_+8;AMiVgC*@cPzscgRqWY-5{Otb(rY#aWKvOPy(sgXE%Us=HjvB44#)Uz*&GB1r(CKY7TQ08S(<`r9}-(V)myb76tl9n7yC}~ZSiCH^g00N#FENNeJ zUM^Mab%~7hCQ1XDbd-5RlzG#ZdCOpLlgviEbeAuMnK3gPYAH}8_3S%hW;RJ=q|1~J zG8riIt|+tFmU+)$TS(@8kb#m`AsJrMDp1n8p(l_TC?r1+GxMQDMw*!nkjX@uk3^Y| zZJAFD_9@AH1~M7DR}YX3RJG^;e-*8pszAVHu&VuB%*+=O8EIxRK_&}jz7%D?vSq$D z*f%8eEy(b~*5rk)A}MUY6Em|_A~P&ASlecSOg734h%(>XGTRLH1IhddGQ74md2Opm zYTKX0%xss)NHdcSGC3%-LzMa1mf2~rUr6Rxkm2R6$;(?MYV`qFrNA zk;>$P%ovpUTa@{)Ewk5P|B%c+kV#%P1*i7*f46ZhY(eJDhLbTs8GI{2k^3*W1Zt=% zwqN2Rt#HSHiyK`Ih%W!LT@D)T5W46=@c9OGG6r9X-u^#B(|TccZ{-JXtb%Po$5W;U z!=XZU^ikNuUsU#6LAqLQkjeuoJp>@ZOAp0i__r554E78?99j~LzyO{;R?TS!cdk%K zaQn{1y$-?Zay=5qai&aDXlO|=76W*3tbCrl z%!tBo2EfZ(xqH`2?BNUQnWV?zIF7&htMqv687?TzU_J;IpkM+(qF^Ep6A(;-Jws21 zmIPBUfR{-WJ@fB}EeLK~vLAzh;AA}q#}Nc`v1f#Wg&;T<1;+p+3c7Ka zfM6c%8G1gnBv^ofR|(%__M%t+_L(1|m$!1Os|o`ySUp)UghRz^a4hx=7nELuV?nS8 z1&aU@1&eW*fM5yi8TvSAN$@ZXyh==IkqJ6pGkWiqUJNSt)y5A%5D=WAkH>L@n`8p^ zj8L!$1dCDdaDYU?i8xF^@Cev5^dq4q!BPz18f^5EmznVHTNG3tY;84zY(dXadKr!* zEO9yZ3>TE%B*h?Df`XF(5(O)8n1JA9*faDg(30R$7}(z)O!)TD2VUMv`1Ua15Uif6 zPsMSB3?7X=!v&>FTmpjQQ1BRlM8RWm7!(}*zTV{TY|)Q{zB>JQXiFSl`KQ6JTzVxQ z4)ldL29s%zOlo1eV?wM0G;r$Iai%9_`SZ{r~CZ+iP#$i z-@b!N<^={l2|8!%UT6*dWN1OWPM?ke3_8j;kA@0{p@Qd0`5DBk#Gk_XnHC@F;77^% zYT|2%pT+r8i4Reoe2AQ%P5f!ZpU(L+EI!OJf2f>4llZfU$4~oo{$~>(riMHCFgZVm z_;ZLqm-BTNAK~D`<@|ZX*Aw5s`9|X5%btUekn>H%Hxu8&c^~l+YNUgYl=H2`&m~^t ze4E8bIru0!KacqHiErn82k}vYze~<{67MH|KIa+nE;ZUQf3%#}iSHu5oAW)yN2@Uo zK1R+jAbuh7i#Wg7;*%WwXgPlY@fQ+*5$6r!W7N?WkGEp1oL@rx#l-h={t}Cib<7_p z=PxDxGU6}i{1wEp zN&H>J-_7}ZEI!rYpDO2962FT0KF;53@#zjeP0rs({Qbl~!1)J>Pg9+Ix}1NA_=kyq zg!8K{KEpA8hMa$t_{WHUobyi*pP^(?cj6d{0qdtNc>Bjf7#-59DJ^ve}(vd;!V!KN_>vs zKSs{KM*Qoa1r^M%}`40a=IsX~)pA-KD=f5OAUoCLV zKUU6vMf}&qf5Z82E#8^`B02vZ@mq->;QaT*7pOdcSbr7E`EA7iK>UxK|H7^*cVm b`)ZS*ROkN}l8oDP;h#UBx2rwLn{S%DIv#=-AXfvLmmubZd&=6SWw z7H`xhUu)>p+Yi-Lo#;kYlX2P8O49ia#0ZT zu?+*SI*1&r%BHarHG>AJVx?;Mx*aN9r#eK(?uELE6yHU*f+q&sJ5OAL=@HtJ)%>R0uNY^L^ zOk&Z*DVn%UlM0Y)8q`DO(v5mkdvdESN5QQD{JENZVa4dG97Xfzv5Xt3b^tY?Qvlc2v%H=0XK1vE@jnXPG
64RgxP#)sBmqrk ziY8~7CTHvH95Sf^lhn}t>v84I_#;RrJxe<=;3idIa;}(@^Lm>|bCLiiiD+`ZXmWvR zQmeCBWKsvKV?0(puAJuc>|}BvbR%#RcX=tR7jx3k+oVrU?2wa0FtMRYqiE7(nl$Uo zOD40yn5d(f zIvqOeB%LnMIaspa50iRa2?v+dV-UEa{Vwd`I_`2dU(Cxzy+x!elnf#RP-KB9vd|P+ zq_c}j+!zZrV$Gi%2)^01!z*k;_C8zbSIL&aNPl zE8z=hn~?}t)Y?hiXcP!sLeE<+QaPGk1tONExw?;tY-v(JWFU%MBZ^#Wid?6&>q+DW z5IHi|>Bsq9arL1+8~AX1jU9Tph5hVy#@yS4`X7Llqk>^5;}mi88rE=?+kq@l>|qR1Vl$elX7i$v~*jQsiQ zS{KgmN;URKVArx`-4+q|Shh^e$UVJ9q!~#AkwGZ3Tok$26j`CO`$*(|$VmMD1wAB^ z?!Lp1L16FI1wjaKX|S+!kDbc8MUw~mWikj%($VBW(c~f1wI|3c z*}%Tlne|o~sAOLfWj6L#W-!QPq0Gyo%qyl$KxaXcc@-b8Bctpj!;9G<6tmc4?$}cH znsuX8u-7Fr(%UBsWQL&3CQ;@MQ)aWy-XxhV@TJ2m*&wfE1HY}Sw#r~7`<9rQtr8jO zG7SNlY?OIhl-Xv=yrZ*sN#;Gs3>332$b%=yi`jsrn0;T&%m)$~X=buPCI@Al3$3K`BEa&Co@>p=7LNf%JhgbdrX+D(D zWtG9I_8T!X-%4bpnaKm0e3aQI%6wygO&v2F@Uc<`x{^bix)L{gA0SeYg4y(L%;Vv?lIax9LMt4eub8bJ$(hG87u<9VJMgekSI6^hY1U&!;!9KKudy|7(nGU;}6vF z1Y^12mZcpotKe8|FpeV#W?@f11&4uPF$xX=NEFP*VZwqraHMOw(2`&t2A;qVWyAd_ z7&yG*848@6HnzB+hcB^voR$x#ih>2$(@()-5FCzzLje*6?Kn(Wun>-Ptq58Y9EO1> z7_qO_4mzH|_xl&XCoJ&}_wDr%aKXxPS}~j|?!n>M(^pWs2Zw`T2?~|~Bnp<|FkwLl z9O>E!Xi4xG3_O9~AKK|huVBh6^Sd!{?p*m}Jp^IF6Sa{zj&PG4i#`1mECIn%6g&`sUK_ZV zRspT9O`ucbYBe_oN`w;WrFZP`Uf-)}6QL7cGZ!ewhThkAdNr?4n}od)@YXxRF*iKu z>CjoNd7#y`GoS_WT5U20Fldx_E)5k4Lq*P&@>7Uch(D9_Qw=`G!bi#ZO5&@CpT_y= z#78SuK3dLK6F-CanVdh%;A1WG$H@7!i9d&Ue5p^@e=hN{N}Pp{mGkEje?IXSaK6^y z<1KugoS#K}9r5*?Zy+At=~?)AIp0Wp6Ya=wfBBqiCxC(HTy#9u`G z0?scq_;d?DK+Z2B{$k=U;k-_KvNFKn@m5Tc^Oq8T8S#G3UvBUzmiY(D`74OOlK87Q ze>L$b%0LUBD(9~u{#xR%xs`*@+^G5oZmqFOT=&F{L2QPZ{Z8%{42xj4N5mH@MHc^JIlq(mkBR?;^Sg*IQifUPA1>!VC4M*Y zpK<}M0}~Re@BLSZ%sOs>iqv= TEdTAH{Q_LA_A9hqjide#H+n2o literal 0 HcmV?d00001 diff --git a/data/chempy/fragments/utpA.pkl b/data/chempy/fragments/utpA.pkl new file mode 100644 index 0000000000000000000000000000000000000000..11ae0560e50b7921a0c6afcac71bf8cfb2dbbc72 GIT binary patch literal 2433 zcmZA1No*WN6b4|=zIs+Kcu6u2At^91cnbswF2@OtDdGj_U_wmB_Oxk($CKwJwh0v` zEHQ~$gpjy!z=#tZ5JFKT5Yo&Mp@fR~?kmjZj9G{<_rf?a@x~~JYGUFYF>#06FeA*h6~#FuWRw(<*BPZa zq-9h?n1}hCQ7wl$8P$tu+pL>7G{~rtFdy?fXEkwXmeCFo1)R}N4!dNOA!PVF{LWf`>Wu$>@lPQqEaNIXoaEjj)u}A+}+dp#j}HHeblYgQL*@{|W2G zp)fpD0LI~AJcP5x+zcGkUApd`%E170nIY!VBRD*DYGxrnj)!d!2mEu(`SHRu4C$^R z-8(auH(*$lo-?^cctq>jxO%l*RaK??CJJ~$;n7iejA%4?-k-ryjb@@U*2;-Xhl)62 zh$D(k=p2p{Q#{@rU~YW0+r+1t_>@6&SoaLJ51EMnHTEmw}N ziK1LPIhn;msUsYouvHJLp6zN!rFw#BJ)6B3slaIS*`EZ4y)J!&S6h9O!%189q3Ts? zpXjx(d!Oj_MrS9*Nut+L?6qzSqq{EbS;uj$9Q|}ZUTyU$4ySC@i>gnl)(%*zV+XRR zCf`}f2#hv=HX@61JlbEz5w!zj9B_lT_SKK7U#V8FU6s8~pxU_JTSP;nO>Z2>EA|>r zj8iO>n&V*DY5>)MQmtMs)zRxDstwmZLITx>`7g4fC~aOoC<>)M&B3(QAgV#7TD^8w z_Bw@XQ{#JOfzi6R%%UjDi8oJXuu$qV9GfB&npRBN}Z zc@8tS8b&p&RIAsH%3ceo?mY7Dn!sr4M|n)Oa_GYw>o}r%JgaVA z)t28@sZ`S+e2Z7yf#7Q28Wu{O<1lZlQB~%rx>$$(z1xC}GR#Dmvwr3pb z84ioKT8(P8QU~xYa1XT07uNb3h?igq(K>6n8cl3%Yw4d8&1(*HnZt878bdUuP|>Qp zucPA4I*Vxi;@9g)Xf)9Oc~%sqYu4vLt^aur+(zSw#uX}d)jcRt$EKbW%m4nEg?hf* zEsN4G-91Ir75V~)qKzgHO(@h_erLt<&m*dScIwhT&Y-20evio)OrbAwc*#bSh$asP2KN*m-)F{02_4zJm04Wc#M b(E}Ce>xd@RkxFfSU`zi_%l83M{A>FU6T!W- literal 0 HcmV?d00001 diff --git a/modules/pmg_qt/builder.py b/modules/pmg_qt/builder.py index 15fc3ba5a..7c69f47a0 100644 --- a/modules/pmg_qt/builder.py +++ b/modules/pmg_qt/builder.py @@ -13,7 +13,6 @@ Qt = QtCore.Qt from pymol.wizard import Wizard -from pymol.parsing import QuietException from pymol import editor from pymol import computing @@ -306,7 +305,7 @@ def __init__(self, _self=pymol.cmd): RepeatableActionWizard.__init__(self,_self) self.mode = 0 - def do_pick(self, bondFlag): + def do_pick(self, bondFlag,*,_self=pymol.cmd): if self.mode == 0: self.cmd.select(active_sele, "bymol pk1") editor.attach_fragment("pk1", self.fragment, self.position, self.geometry, _self=self.cmd) @@ -328,14 +327,9 @@ def toggle(self, fragment, position, geometry, text): self.setActionHash( (fragment, position, geometry, text) ) self.activateRepeatOrDismiss() - def create_new(self): - names = self.cmd.get_names("objects") - num = 1 - while 1: - name = "obj%02d"%num - if name not in names: - break - num = num + 1 + def create_new(self,*,_self=pymol.cmd): + self.cmd.unpick() + name = self.cmd.get_unused_name("obj") self.cmd.fragment(self.fragment, name) if not self.getRepeating(): self.actionWizardDone() @@ -356,7 +350,7 @@ def combine(self): def get_panel(self): if self.getRepeating(): return [ - [ 1, 'Attaching Multiple Fragmnts',''], + [ 1, 'Attaching Multiple Fragments',''], [ 2, 'Create As New Object','cmd.get_wizard().create_new()'], [ 2, 'Combine w/ Existing Object','cmd.get_wizard().combine()'], [ 2, 'Done','cmd.set_wizard()'], @@ -371,34 +365,56 @@ def get_panel(self): ] -class AminoAcidWizard(RepeatableActionWizard): +class BioPolymerWizard(RepeatableActionWizard): - def __init__(self, _self=pymol.cmd, ss=-1): + HIGHLIGHT_SELE = "" + + def __init__(self, _self=pymol.cmd): RepeatableActionWizard.__init__(self,_self) self.mode = 0 - self.setSecondaryStructure(ss) + self._highlighting_enabled = False - def setSecondaryStructure(self, ss): - self._secondary_structure = ss + def __enter__(self): + '''Context manager for temporarily disabling attachment point highlights + ''' + self.highlight_attachment_points(False) + + def __exit__(self, *_): + self.highlight_attachment_points() + + def cleanup(self): + self.highlight_attachment_points(False) + RepeatableActionWizard.cleanup(self) + + def highlight_attachment_points(self, show=True): + '''Show spheres for potential attachment points + + :type show: bool + :param show: Switch to show or hide the highlights + ''' + if self._highlighting_enabled: + fn = self.cmd.show if show else self.cmd.hide + fn('spheres', self.HIGHLIGHT_SELE) def attach_monomer(self, objectname=""): - editor.attach_amino_acid("?pk1", self.aminoAcid, object=objectname, - ss=self._secondary_structure, - _self=self.cmd) + raise NotImplementedError + + def combine_monomer(self): + raise NotImplementedError def do_pick(self, bondFlag): # since this function can change any position of atoms in a related # molecule, bymol is used if self.mode == 0: - self.cmd.select(active_sele, "bymol pk1") + self.cmd.select(active_sele, "bymol ?pk1") try: with undocontext(self.cmd, "bymol ?pk1"): - self.attach_monomer(self.aminoAcid) - except QuietException: - fin = -1 + self.attach_monomer() + except pymol.CmdException as exc: + print(exc) elif self.mode == 1: - self.cmd.select(active_sele, "bymol pk1") - editor.combine_fragment("pk1", self.aminoAcid, 0, 1, _self=self.cmd) + self.cmd.select(active_sele, "bymol ?pk1") + editor.combine_monomer() self.mode = 0 self.cmd.refresh_wizard() @@ -406,23 +422,25 @@ def do_pick(self, bondFlag): if not self.getRepeating(): self.actionWizardDone() - def toggle(self, amino_acid): - self.aminoAcid = amino_acid - self.setActionHash( (amino_acid,) ) - self.activateRepeatOrDismiss() + def toggle(self, monomer): + self._monomer = monomer + self.setActionHash( (monomer,) ) + if self.activateRepeatOrDismiss(): + # enable temporary sphere highlighting of attachment points, but only + # if currently no spheres are displayed + self._highlighting_enabled = self.HIGHLIGHT_SELE and self.cmd.count_atoms( + '(rep spheres) & ({})'.format(self.HIGHLIGHT_SELE)) == 0 - def create_new(self): - names = self.cmd.get_names("objects") - num = 1 - while 1: - name = "obj%02d"%num - if name not in names: - break - num = num + 1 - self.attach_monomer(self.aminoAcid) + self.highlight_attachment_points() + def create_new(self, *, _self=pymol.cmd): + self.cmd.unpick() + name = self.cmd.get_unused_name("obj") + self.attach_monomer(name) if not self.getRepeating(): self.actionWizardDone() + else: + self.cmd.unpick() def combine(self): self.mode = 1 @@ -431,29 +449,67 @@ def combine(self): def get_prompt(self): if self.mode == 0: if self.getRepeating(): - return ["Pick locations to attach %s..."%self.aminoAcid] + return ["Pick locations to attach %s..." % self._monomer] else: - return ["Pick location to attach %s..."%self.aminoAcid] + return ["Pick location to attach %s..." % self._monomer] else: - return ["Pick object to combine %s into..."%self.aminoAcid] + return ["Pick object to combine %s into..." % self._monomer] def get_panel(self): if self.getRepeating(): return [ [ 1, 'Attaching Multiple Residues',''], [ 2, 'Create As New Object','cmd.get_wizard().create_new()'], - [ 2, 'Combine w/ Existing Object','cmd.get_wizard().combine()'], [ 2, 'Done','cmd.set_wizard()'], ] else: return [ [ 1, 'Attaching Amino Acid',''], [ 2, 'Create As New Object','cmd.get_wizard().create_new()'], - [ 2, 'Combine w/ Existing Object','cmd.get_wizard().combine()'], [ 2, 'Attach Multiple...','cmd.get_wizard().repeat()'], [ 2, 'Done','cmd.set_wizard()'], ] +class AminoAcidWizard(BioPolymerWizard): + + HIGHLIGHT_SELE = "(name N &! neighbor name C) | (name C &! neighbor name N)" + + def __init__(self, _self=pymol.cmd, ss=-1): + BioPolymerWizard.__init__(self,_self) + self._monomerType = "Amino Acid" + self.setSecondaryStructure(ss) + + def setSecondaryStructure(self, ss): + self._secondary_structure = ss + + def attach_monomer(self, objectname=""): + with self: + editor.attach_amino_acid("?pk1", self._monomer, object=objectname, + ss=self._secondary_structure, + _self=self.cmd) + + def combine_monomer(self): + editor.combine_fragment("pk1", self._monomer, 0, 1, _self=self.cmd) + +class NucleicAcidWizard(BioPolymerWizard): + + HIGHLIGHT_SELE = "(name O3' &! neighbor name P) | (name P &! neighbor name O3') | (name O5' &! neighbor name P) " + + def _init(self, form, dbl_helix, nuc_type): + self._monomerType = "Nucleic Acid" + self._form = form + self._dbl_helix = dbl_helix + self._nuc_type = nuc_type + return self + + def attach_monomer(self, objectname=""): + with self: + editor.attach_nuc_acid("?pk1", self._monomer, object=objectname, + nuc_type=self._nuc_type, form=self._form, + dbl_helix=self._dbl_helix, _self=self.cmd) + + def combine_monomer(self): + editor.combine_nucleotide("pk1", self._monomer + self._form, 0, 1, _self=self.cmd) class ValenceWizard(RepeatableActionWizard): @@ -950,6 +1006,14 @@ def collectPicked(self_cmd): return result +############################################################# +### Nucleic Acid helper class + +class NucleicAcidProperties: + def __init__(self, form="B", double_helix=True): + self.dna_form = form + self.dna_dbl_helix = double_helix + ############################################################# ### Actual GUI @@ -995,8 +1059,15 @@ def __init__(self, parent=None, app=None): self.protein_tab = QtWidgets.QWidget() self.protein_tab.setLayout(self.protein_layout) + self.nucleic_acid_layout = QtWidgets.QVBoxLayout() + self.nucleic_acid_layout.setContentsMargins(5, 5, 5, 5) + self.nucleic_acid_layout.setSpacing(5) + self.nucleic_acid_tab = QtWidgets.QWidget() + self.nucleic_acid_tab.setLayout(self.nucleic_acid_layout) + self.tabs.addTab(self.fragments_tab, "Chemical") self.tabs.addTab(self.protein_tab, "Protein") + self.tabs.addTab(self.nucleic_acid_tab, "Nucleic Acid") self.getIcons() @@ -1082,6 +1153,76 @@ def __init__(self, parent=None, app=None): self.protein_layout.addWidget(self.ss_cbox, 2, lab_cols, 1, 4) self.ss_cbox.currentIndexChanged[int].connect(self.ssIndexChanged) + self.nucleic_acid_dna_layout = QtWidgets.QGridLayout() + self.nucleic_acid_dna_layout.setContentsMargins(5, 5, 5, 5) + self.nucleic_acid_dna_layout.setSpacing(5) + self.nucleic_acid_rna_layout = QtWidgets.QGridLayout() + self.nucleic_acid_rna_layout.setContentsMargins(5, 5, 5, 5) + self.nucleic_acid_rna_layout.setSpacing(5) + + + self.nucleic_acid_tab = QtWidgets.QTabWidget() + self.nucleic_acid_layout.addWidget(self.nucleic_acid_tab) + self.dna_tab = QtWidgets.QWidget() + self.dna_tab.setLayout(self.nucleic_acid_dna_layout) + self.rna_tab = QtWidgets.QWidget() + self.rna_tab.setLayout(self.nucleic_acid_rna_layout) + + self.nucleic_acid_tab.addTab(self.dna_tab, "DNA") + self.nucleic_acid_tab.addTab(self.rna_tab, "RNA") + + self._nuc_acid_prop = NucleicAcidProperties() + + dna_buttons = ( + ("A", "Deoxyadenosine", None, lambda: self.attach_nuc_acid("atp", "DNA")), + ("C", "Deoxycytidine", None, lambda: self.attach_nuc_acid("ctp", "DNA")), + ("T", "Deoxythymidine", None, lambda: self.attach_nuc_acid("ttp", "DNA")), + ("G", "Deoxyguanosine", None, lambda: self.attach_nuc_acid("gtp", "DNA")), + ("@Form:", None, None, None), + ("#A", None, False, lambda: setattr(self._nuc_acid_prop, 'dna_form', "A")), + ("#B", None, True, lambda: setattr(self._nuc_acid_prop, 'dna_form', "B")), + ("@Helix:", None, None, None), + ("#Single", None, False, lambda: setattr(self._nuc_acid_prop, 'dna_dbl_helix', False)), + ("#Double", None, True, lambda: setattr(self._nuc_acid_prop, 'dna_dbl_helix', True)) + ) + for col_num, btn_pkg in enumerate(dna_buttons): + btn_label, btn_tooltip, default_activated, btn_command = btn_pkg + if btn_label[0] == '@': + btn = QtWidgets.QLabel(btn_label[1:]) + radio_group = QtWidgets.QButtonGroup(self) + elif btn_label[0] == '#': + btn = QtWidgets.QRadioButton(btn_label[1:]) + btn.toggled.connect(btn_command) + btn.setChecked(default_activated) + radio_group.addButton(btn) + else: + btn = makeFragmentButton() + btn.setText(btn_label) + btn.setToolTip(btn_tooltip) + btn.clicked.connect(btn_command) + self.nucleic_acid_dna_layout.addWidget(btn, 0, col_num) + + + rna_buttons = ( + ("A", "Adenosine", "atp", lambda: self.attach_nuc_acid("atp", "RNA")), + ("C", "Cytosine", "ctp", lambda: self.attach_nuc_acid("ctp", "RNA")), + ("U", "Uracil", "utp", lambda: self.attach_nuc_acid("utp", "RNA")), + ("G", "Guanine", "gtp", lambda: self.attach_nuc_acid("gtp", "RNA"))) + + for col_num, btn_pkg in enumerate(rna_buttons): + btn_label, btn_tooltip, btn_filename, btn_command = btn_pkg + btn = makeFragmentButton() + btn.setText(btn_label) + btn.setToolTip(btn_tooltip) + btn.clicked.connect(btn_command) + self.nucleic_acid_rna_layout.addWidget(btn, 0, col_num) + + btn = QtWidgets.QLabel('Hint: Also check out ' + 'fiber and its ' + 'PyMOL wrapper') + btn.setOpenExternalLinks(True) + self.nucleic_acid_rna_layout.addWidget(btn, 0, col_num + 1) + buttons = [ [ ( "@Atoms:", None, None), @@ -1094,6 +1235,8 @@ def __init__(self, parent=None, app=None): ( " +1 ", "Positive Charge", lambda: self.setCharge(1,"+1")), ( " 0 ", "Neutral Charge", lambda: self.setCharge(0,"neutral")), ( " -1 ", "Negative Charge", lambda: self.setCharge(-1,"-1")), + ( "@ Residue:", None, None), + ("Remove", "Remove residue", lambda: self.removeResn()), ], [ ( "@Bonds:", None, None), @@ -1139,9 +1282,12 @@ def _(checked, n=setting): self.cmd.set(n, checked, quiet=0) else: btn.setChecked(not value) - @btn.toggled.connect def _(checked, n=setting): self.cmd.set(n, not checked, quiet=0) + if setting == 'suspend_undo': + self.setUndoEnabled(not value) + _ = self.setUndoEnabled + btn.toggled.connect(_) else: btn = makeFragmentButton() btn.setText(btn_label) @@ -1151,6 +1297,29 @@ def _(checked, n=setting): btn_row_layout.addWidget(btn) btn_row_layout.addStretch() + def setUndoEnabled(self, checked): + self.cmd.set('suspend_undo', not checked, quiet=0) + if not checked: + return + + on_per_object = set(oname for oname in self.cmd.get_object_list() + if self.cmd.get_setting_int('suspend_undo', oname)) + + n = len(on_per_object) + if n > 20: + on_per_object = sorted(on_per_object)[:15] + [ + "[{} more]".format(n - 15)] + + if on_per_object: + QMB = QtWidgets.QMessageBox + check = QMB.question(None, 'Enable for objects?', + 'Building "Undo" is disabled for the following objects:\n\n' + + '\n'.join(on_per_object) + '\n\n' + 'Enable "Undo" for these objects?', QMB.Yes | QMB.No) + if check == QMB.Yes: + for oname in on_per_object: + self.cmd.unset('suspend_undo', oname) + def getIcons(self): self.icons = {} # use old Tk icons @@ -1209,6 +1378,37 @@ def ssIndexChanged(self, index): if isinstance(w, AminoAcidWizard): w.setSecondaryStructure(index + 1) + def attach_nuc_acid(self, nuc_acid, nuc_type): + self._nuc_type = nuc_type + picked = collectPicked(self.cmd) + if len(picked)==1: + try: + with undocontext(self.cmd, "byobject %s" % picked[0]): + editor.attach_nuc_acid(picked[0], nuc_acid, + nuc_type=self._nuc_type, + object="", + form=self._nuc_acid_prop.dna_form, + dbl_helix=self._nuc_acid_prop.dna_dbl_helix, + _self=self.cmd) + except pymol.CmdException as exc: + print(exc) + except ValueError as exc: + print(exc) + self.doZoom() + else: + self.cmd.unpick() + NucleicAcidWizard(_self=self.cmd)._init(form=self._nuc_acid_prop.dna_form, + dbl_helix=self._nuc_acid_prop.dna_dbl_helix, + nuc_type=self._nuc_type).toggle(nuc_acid) + + def removeResn(self): + picked = collectPicked(self.cmd) + if picked == ["pk1"]: + self.cmd.select(newest_sele,"byres(pk1)") + self.cmd.remove(newest_sele) + else: + print("Select a single atom on the residue and press remove again") + def doAutoPick(self, old_atoms=None): self.cmd.unpick() if self.cmd.select(newest_sele,"(byobj "+active_sele+") and not "+active_sele)==0: @@ -1228,7 +1428,7 @@ def doAutoPick(self, old_atoms=None): def doZoom(self, *ignore): if "pk1" in self.cmd.get_names("selections"): - self.cmd.zoom("((neighbor pk1) extend 4)", 4.0, animate=-1) + self.cmd.center("%pk1 extend 9", animate=-1) def setCharge(self, charge, text): picked = collectPicked(self.cmd) @@ -1304,12 +1504,6 @@ def invert(self, _=None): self.cmd.unpick() InvertWizard(self.cmd).toggle() - def center(self): - if "pk1" in self.cmd.get_names("selections"): - self.cmd.zoom("pk1", 5.0, animate=-1) - else: - self.cmd.zoom("all", 3.0, animate=-1) - def removeAtom(self): picked = collectPicked(self.cmd) if len(picked): diff --git a/modules/pmg_tk/skins/normal/builder.py b/modules/pmg_tk/skins/normal/builder.py index 6cead85ad..478c2b8fe 100644 --- a/modules/pmg_tk/skins/normal/builder.py +++ b/modules/pmg_tk/skins/normal/builder.py @@ -345,7 +345,7 @@ def combine(self): def get_panel(self): if self.getRepeating(): return [ - [ 1, 'Attaching Multiple Fragmnts',''], + [ 1, 'Attaching Multiple Fragments',''], [ 2, 'Create As New Object','cmd.get_wizard().create_new()'], [ 2, 'Combine w/ Existing Object','cmd.get_wizard().combine()'], [ 2, 'Done','cmd.set_wizard()'], diff --git a/modules/pymol/api.py b/modules/pymol/api.py index 383d9e527..4b24bb8b6 100644 --- a/modules/pymol/api.py +++ b/modules/pymol/api.py @@ -259,7 +259,8 @@ vdw_fit from .editor import \ - fab + fab, \ + fnab from .computing import \ clean diff --git a/modules/pymol/editor.py b/modules/pymol/editor.py index eb16e301a..613ebeb58 100644 --- a/modules/pymol/editor.py +++ b/modules/pymol/editor.py @@ -1,3 +1,5 @@ +import math + import re import pymol cmd = __import__("sys").modules["pymol.cmd"] @@ -384,6 +386,659 @@ def _fab(input,name,mode,resi,chain,segi,state,dir,hydro,ss,quiet,_self=cmd): return r +_threeNA_to_OneNA = { "atp" : "A", "ctp" : "C", "gtp" : "G", "ttp" : "T", "utp" : "U"} +_oneNA_to_threeNA = { "A" : "atp", "C" : "ctp", "G" : "gtp", "T" : "ttp", "U" : "utp"} + +_base_pair = { "DNA" : {"atp" : "ttp", "ctp" : "gtp", "gtp" : "ctp", "ttp" : "atp" }, + "RNA" : {"atp" : "utp", "ctp" : "gtp", "gtp" : "ctp", "utp" : "atp" }} + +_oneNA_base_pair = {"DA" : "DT", "DC" : "DG", "DG" : "DC", "DT" : "DA", "A" : "U", + "C" : "G", "G" : "C", "U" : "A"} + +def iterate_to_list(selection: str, expression: str, *, _self=cmd): + outlist = [] + _self.iterate(selection,f"outlist.append(({expression}))", space={"outlist":outlist}) + return outlist + +def rename_three_to_one(nuc_acid, sele, nuc_type, *, _self=cmd): + """ + Renames nucleobase from 3-letter to 1-letter representation + + :param nuc_acid: (str) 3-letter nucleic acid representation + :param sele: (str) selection of nucleic acid to rename + :param nuc_type: (str) "DNA" or "RNA" + """ + new_name = _threeNA_to_OneNA[nuc_acid] + if nuc_type == "DNA": + new_name = "D" + new_name + _self.alter(sele, f"resn='{new_name}'") + +def fit_sugars(mobile, target, *, _self=cmd): + """ + Fits appending base pairs to form appropriate hydrogen bond + + :param mobile: (str) selection for the sense (main) strand + :param target: (str) selection for the antisense (opposing) strand + """ + try: + _self.pair_fit(f"{mobile} & name C1'", + f"{target} & name C1'", + f"{mobile} & name C2'", + f"{target} & name C2'", + f"{mobile} & name C3'", + f"{target} & name C3'", + f"{mobile} & name C4'", + f"{target} & name C4'", + f"{mobile} & name O4'", + f"{target} & name O4'", quiet=1) + except: + _self.delete(tmp_wild) + raise pymol.CmdException("Something went wrong when fitting the new residue.") + +def fit_DS_fragment(mobile_A, target_A, mobile_B, target_B, *, _self=cmd): + """ + Fits dummy fragment to the detected structure using atoms + on both stands for a more accurate alignment. + + :param mobile_A: (str) selection for the base being created and attached + :param target_A: (str) selection for the base selected to build on + :param mobile_B: (str) selection for the opposing base being created + :param target_B: (str) selection for the detected opposing base + """ + try: + _self.pair_fit(f"{mobile_A} & name C1'", + f"{target_A} & name C1'", + f"{mobile_A} & name C2'", + f"{target_A} & name C2'", + f"{mobile_A} & name C5'", + f"{target_A} & name C5'", + f"{mobile_A} & name O4'", + f"{target_A} & name O4'", + f"{mobile_A} & name O3'", + f"{target_A} & name O3'", + f"{mobile_A} & name P", + f"{target_A} & name P", + f"{mobile_B} & name O3'", + f"{target_B} & name O3'", + f"{mobile_B} & name C1'", + f"{target_B} & name C1'", + f"{mobile_B} & name C2'", + f"{target_B} & name C2'", + f"{mobile_B} & name C5'", + f"{target_B} & name C5'", + f"{mobile_B} & name P", + f"{target_B} & name P", + f"{mobile_B} & name O4'", + f"{target_B} & name O4'", quiet=1) + except: + _self.delete(tmp_wild) + raise pymol.CmdException("Something went wrong when fitting the new residue.") + +def add2pO(domain, nuc_acid, resv, *, _self=cmd): + if nuc_acid == "utp": #utp comes with O2' + return + c_2p = _prefix + "_c2p" + _self.select(c_2p, "%s & resi \\%i & name %s" % (domain, resv, "C2'")) + _self.unpick() + _self.edit(c_2p) + _self.attach("O", 4, 4) + _self.unpick() + _self.alter("(byres %s) & resi \\%i & name O01" % (domain, resv), "name=\"O2'\"") + +def move_atom_in_res(atom, dummy_res, new_res, twist, rise, *, _self=cmd): + prev_coords = _self.get_coords(f"{dummy_res} & name {atom}", state=1) + curr_coords = _self.get_coords(f"{new_res} & name {atom}", state=1) + + if curr_coords is None or prev_coords is None: + return + curr_coord = curr_coords[0] + prev_coord = prev_coords[0] + + r = math.sqrt(prev_coord[0] ** 2 + + prev_coord[1] ** 2) + old_phi = math.degrees(math.atan2(prev_coord[1],prev_coord[0])) + phi = old_phi - twist + phi = math.radians(phi) + new_pos = [r * math.cos(phi), + r * math.sin(phi), + prev_coord[2] - rise] + + trans = list(new_pos - curr_coord) + _self.translate(trans, f"{new_res} & name {atom}", camera=0) + +def move_new_res(frag_string, full_frag, old, old_oppo, double_stranded_bool=False, form="B", chain="A", antisense=False, *, _self=cmd): + """ + Attaches new residue (or pair) onto current nucleotide chain + + :param frag_string: (str) Name of appending nucleic acid or pair + :param full_frag: (str) Selection of the created fragment + :param old: (str) Selection of previous residue + :param old_oppo: (str) Selection of previous opposing residue + :param double_stranded_bool: (bool) Flag represing if double helix was detected + :param antisense (bool) Flag for antisense + :param form: (str) DNA form ('A'/'B') + """ + if form == 'B': + twist = -36.0 + rise = -3.375 + elif form == 'A': + twist = -32.7 + rise = -2.548 + else: + raise ValueError("Form not recognized") + + rise = rise if antisense else -rise + twist = twist if antisense else -twist + + dummy_fragment = _prefix + "_dummyfrag" + dummy_res_A = _prefix + "_dummyresA" + dummy_res_B = _prefix + "_dummyresB" + new_fragment = _prefix + "_newfrag" + new_res_A = _prefix + "_newresA" + new_res_B = _prefix + "_newresB" + + _self.select(new_fragment, f"{full_frag}") + _self.select(new_res_A,f"{full_frag} and chain A") + _self.select(new_res_B,f"{full_frag} and chain B") + + _self.fragment(frag_string, dummy_fragment, origin=0) + _self.select(dummy_res_A, f"{dummy_fragment} and chain A") + _self.select(dummy_res_B, f"{dummy_fragment} and chain B") + + if old_oppo == "none": + # This is the case where a single residue is being added + _self.select(dummy_res_A, f"{dummy_fragment}") + _self.select(new_res_A, f"{full_frag}") + + atoms_A = iterate_to_list(dummy_res_A, "name") + atoms_B = iterate_to_list(dummy_res_B, "name") + + #A new base is created by copying the coordinates of the previous + #base and doing a cylindrical rotation (phi degrees) and a translation + #down the z-axis by the rise amount + for atom in atoms_A: + move_atom_in_res(atom, dummy_res_A, new_res_A, twist, rise) + for atom in atoms_B: + move_atom_in_res(atom, dummy_res_B, new_res_B, twist, rise) + if double_stranded_bool == True: + fit_DS_fragment(dummy_res_A, old, dummy_res_B, old_oppo) + orient_flag = check_dummy_oriention(old,dummy_res_A) + if orient_flag == 0: + fit_sugars(dummy_res_A,old) + elif double_stranded_bool == False: + fit_sugars(dummy_res_A, old) + else: + raise pymol.CmdException("Double stranded bool was not provided to move_new_res") + + dummy_fragment_transform = _self.get_object_matrix(dummy_fragment) + _self.transform_object(full_frag, dummy_fragment_transform) + _self.delete(dummy_fragment) + +def check_dummy_oriention(old, dummy_res_A, *, _self=cmd): + dummy_orient = _prefix + "_dummy_orient" + orient_flag = 0 + orient_flag = _self.select(dummy_orient, f"({old} & name O4') within 1.0 of ({dummy_res_A} & name O4')") + + return orient_flag + +class NascentNucAcidInfo: + def __init__(self, fragment_name, nuc_acid, nuc_type, form, dbl_helix): + self.fragment_name = fragment_name + self.nuc_acid = nuc_acid + self.nuc_type = nuc_type + self.form = form + self.dbl_helix = dbl_helix + +def attach_O5_phosphate(_self=cmd): + if "pk1" not in _self.get_names("selections"): + raise pymol.CmdException("Selection must be pk1 to attach O5' phosphate") + + print("This building selection has an unphosphorylated O5' end.") + attach_fragment("pk1","phosphite",4,0) + # Initailize selection strings + P_center = _prefix + "_P_center" + H_extra = _prefix + "_H_extra" + O_one = _prefix + "_O_one" + O_two = _prefix + "_O_two" + O_three = _prefix + "_O_three" + + # Selection + _self.select(P_center,"n. P01") + _self.select(H_extra, f"h. and bound_to {P_center} or n. H02") + _self.select(O_one, f"n. O01 and bound_to {P_center}") + _self.select(O_two, f"n. O02 and bound_to {P_center}") + _self.select(O_three, f"n. O03 and bound_to {P_center}") + + # Removing unnecessary atoms + _self.remove(H_extra) + _self.remove(O_one) + + # Fix bonding + _self.unbond(P_center,O_three) + _self.bond(P_center,O_three,1) + _self.unbond(P_center,O_two) + _self.bond(P_center,O_two,2) + + # Rename P correctly + _self.alter(P_center,"name = 'P'") + + # Set Pk1 correctly + _self.select("pk1",P_center) + +def check_DNA_base_pair(sele_oppo_atom, selection, *, _self=cmd): + base_pair_dist = _prefix + "_base_pair_dist" + base_pair_bool = 0 + tmp_last_resn = iterate_to_list(selection,"resn") + tmp_last_resn_oppo = iterate_to_list(sele_oppo_atom,"resn") + + if len(tmp_last_resn_oppo) != 0: + last_resn = str(tmp_last_resn[0]) + last_resn_oppo = str(tmp_last_resn_oppo[0]) + + if (_oneNA_base_pair[last_resn] == last_resn_oppo and + _self.select(base_pair_dist, f"(byres {sele_oppo_atom}) within 3.5 of (byres {selection})") != 0): + base_pair_bool = 1 + else: + base_pair_bool = 0 + else: + print("check_DNA_base_pair has no opposing residue to check") + return base_pair_bool + +def get_chains_oppo (chain, tmp_connect, *, _self=cmd): + models = iterate_to_list(tmp_connect,"model") + + close_chains = [] + close_chains = _self.get_chains(f"({models[0]}) within 15.0 of {tmp_connect}") + close_chains = [c for c in close_chains if c != chain] + + return close_chains + +def get_new_chain (chain, tmp_connect, *, _self=cmd): + models = iterate_to_list(tmp_connect,"model") + model_chains = _self.get_chains(models[0]) + search_chain_flag = 0 + + if len(model_chains) != 0: + last_chain = f"{model_chains[-1]}" + last_chain_front = last_chain[:-1] + last_chain_back = last_chain[-1] + if last_chain_back != 'Z' and last_chain_back != 'z': + new_chain_back = chr(ord(last_chain_back)+1) + elif last_chain_back == 'Z': + new_chain_back = "ZA" + print("Z chain was detected. New chain will append A") + else: + new_chain_back = "za" + print("z chain was detected. New chain will append a") + else: + new_chain_back = "A" + + chain_oppo = last_chain_front + new_chain_back + return chain_oppo + +def check_valid_attachment(nascent, atom_selection_name, selection, resv, *, _self=cmd): + atom_selection_name_partner = "O3'" if atom_selection_name == "P" else "P" + atom_sele = _prefix + "atom_sele" + _self.select(atom_sele, f"{selection}") + bound = _prefix + "atom_sele_bound" + if _self.count_atoms(f"(bound_to {atom_sele}) & name {atom_selection_name_partner}") != 0: + _self.delete(tmp_wild) + raise pymol.CmdException(f"{atom_selection_name} already bonded!") + +def bond_single_stranded(tmp_editor, object, chain, resv, last_resi_sele, atom_selection_name, atom_name_oppo, *, _self=cmd): + """ + Forms a bond between the last atoms on selected structure and the newly created fragment + :param tmp_editor: (str) Object representing the newly created fragment + :param object: (str) object/model name of the selected structure + :param chain: (str) Chain ID + :param resv: (int) + :param last_resi_sele: (str) The selection string of the selected residue + :param atom_selection_name: (str) Name of the atom selected + :param atom_name_oppo: (str) Name of the corresponding opposing atom + """ + object_fuse = _prefix + f"_{chain}_fuse" + object_connect = _prefix + f"_{chain}_con" + + print("The program did not detect a double stranded structure, so the opposing residue will not be attached.") + + # Select and fuse + _self.select(object_fuse, f"{last_resi_sele} & name {atom_selection_name}") + _self.fuse(f"{tmp_editor} & chain {chain} & name {atom_name_oppo}", object_fuse, mode=3) + _self.select(object_connect, f"{last_resi_sele} & name {atom_selection_name} & chain {chain}") + + # Target is on the new fragment + object_bond_target = _prefix + f"_{chain}_con_target" + if (_self.select(object_bond_target, f"{object} & resi \\{resv} & name {atom_name_oppo} & chain {chain}") == 1): + bond_dist = _prefix + "_bond_dist" + if (_self.select(bond_dist, f"{object_connect} within 3.0 of {object_bond_target}") != 0): + _self.bond(object_connect, object_bond_target) + else: + print("Identified bond targets were too far apart, so this will not be bound") + else: + print("More than one bond target was identified, so this will not be bound") + +def bond_double_stranded(tmp_editor, object, chain, chain_oppo, resv, resv_oppo, last_resi_sele, prev_oppo_res, atom_selection_name, + atom_name_oppo, *, _self=cmd): + """ + Forms a bond between the last atoms on selected structure and the newly created fragment + :param tmp_editor: (str) Object representing the newly created fragment + :param object: (str) object/model name of the selected structure + :param chain: (str) Chain ID + :param chain_oppo: (str) Opposing chain ID + :param resv: (int) + :param resv_oppo: (int) + :param last_resi_sele: (str) The selection string of the selected residue + :param prev_oppo_res: (str) The selection string of the previous opposing residue + :param atom_selection_name: (str) Name of the atom selected + :param atom_name_oppo: (str) Name of the corresponding opposing atom + """ + object_fuse = _prefix + f"_{chain}_fuse" + object_oppo_fuse = _prefix + f"_oppo_{chain_oppo}_fuse" + object_connect = _prefix + f"_{chain}_con" + object_oppo_connect = _prefix + f"_oppo_{chain_oppo}_con" + + # Target is on the new fragment + object_bond_target = _prefix + f"_{chain}_con_target" + object_oppo_bond_target = _prefix + f"_oppo_{chain_oppo}_con_target" + + # Select and fuse + _self.select(object_fuse, f"{last_resi_sele} & name {atom_selection_name}") + _self.select(object_oppo_fuse, f"{prev_oppo_res} & name {atom_name_oppo}") + _self.fuse(f"{tmp_editor} & chain {chain} & name {atom_name_oppo}", object_fuse, mode=3) + + if ((_self.select(object_bond_target, f"{object} & resi \\{resv} & name {atom_name_oppo} & chain {chain}") == 1) and + (_self.select(object_connect, f"{last_resi_sele} & name {atom_selection_name} & chain {chain}") == 1)): + bond_dist = _prefix + "_bond_dist" + if (_self.select(bond_dist, f"{object_connect} within 3.0 of {object_bond_target}") != 0): + _self.bond(object_connect, object_bond_target) + else: + print("Identified bond targets were too far apart, so this will not be bound") + else: + print("More than one bond target was found on selected chain, so this will not be bound.") + + if ((_self.select(object_oppo_bond_target, f"{object} & resi \\{resv_oppo} & name {atom_selection_name} & chain {chain_oppo}") == 1) and + (_self.select(object_oppo_connect, f"{prev_oppo_res} & name {atom_name_oppo} & chain {chain_oppo}") == 1)): + bond_dist = _prefix + "_bond_dist" + if (_self.select(bond_dist, f"{object_oppo_connect} within 3.0 of {object_oppo_bond_target}") != 0): + _self.bond(object_oppo_connect, object_oppo_bond_target) + else: + print("Identified bond targets were too far apart, so this will not be bound") + else: + print("More than one bond target was found on opposing chain, so this will not be bound.") + +def attach_nuc_acid(selection, nuc_acid, nuc_type, object= "", form ="B", + dbl_helix=True, *, _self=cmd): + """ + Creates new nuc acid attached to existing PDB structure + :param selection: (str) selection of picked nascent chain (or nothing) + :param nuc_acid: (str) appending nucleic acid + :param nuc_type: (str) sugar type of nucleic acid + :param object: (str) name of appending nucleobase + :param form: (str) DNA structure form: A, B, or Z + :param dbl_helix: (bool) flag for double-strandedness + """ + original_sele = _prefix + "_original_sele" + _self.select(original_sele,selection) + + if nuc_type == "RNA" and form != 'A': + form = 'A' + dbl_helix = False + + nascent = NascentNucAcidInfo(nuc_acid + form, nuc_acid, nuc_type, form, dbl_helix) + nuc_acid_partner_temp = _base_pair[nuc_type][nuc_acid].lower() + nascent_partner = NascentNucAcidInfo(nuc_acid_partner_temp + form, nuc_acid_partner_temp, + nuc_type, form, dbl_helix) + + if _self.cmd.count_atoms(selection) == 0: + if object == "": + object = nuc_acid + + if dbl_helix: + frag_string = nascent.nuc_acid + "_"+ _base_pair["DNA"][nascent.nuc_acid] + nascent.form + _self.fragment(frag_string,object) + elif not dbl_helix: + _self.fragment(nascent.fragment_name, object, origin=0) + _self.alter(object, f"segi='A';chain='A';resv=1") + rename_three_to_one(nascent.nuc_acid, object, nascent.nuc_type) + + if nascent.nuc_type == "RNA": + add2pO(object, nascent.nuc_acid, 1) + + if _self.count_atoms(f"{object} & segi A & name P"): + _self.edit(f"{object} & segi A & name P") + elif _self.count_atoms(f"{object} & segi A & name O3'"): + _self.edit(f"{object} & segi A & name O3'") + _self.edit(f"{object} & segi A & name O3'") + _self.select("pk1", f"{object} & name O3' & chain A") + elif _self.select(tmp_connect, f'{selection}') == 1: + chain, name, object = iterate_to_list(selection,"chain,name,model")[0] + + if name == "O5'": + attach_O5_phosphate() + name = "P" + # FIXME Don't use `selection` as the name, or ensure that it's + # indeed just a name and not a selection expression. + _self.select(selection,f"name P & bound_to {original_sele}") + _self.delete("_pkdihe") + _self.select(tmp_connect,f"{selection}") + + if name == "P" or name == "O3'": + extend_nuc_acid(nascent, nascent_partner, selection, object, name, chain, _self=_self) + + _self.select("pk1","_tmp_editor_new_selection") + else: + _self.delete(tmp_wild) + raise pymol.CmdException("invalid connection point: must be one atom, name O3' or P") + + _self.show("cartoon", f"byobject {selection}") + _self.delete(tmp_wild) + +def extend_nuc_acid(nascent, nascent_partner, selection, + object, atom_selection_name, chain = 'A', *, _self=cmd): + """ + Creates new nuc acid (or pair) or attaches to PDB chain + :param nascent: (NascentNucAcidInfo) appending nucleic acid + :param nascent_partner: (NascentNucAcidInfo) partner of appending nucleic acid + :param selection: (str) selection string of selected residue + :param object: (str) object of selected residue + :param atom_selection_name: (str) O3' or P + :param chain: (str) chain ID + + FIXME Eliminate `tmp_connect` pre-condition (or at least document it + properly). Looks like `tmp_connect` must be the same as `selection`? + """ + # Making a temporary selection + original_sele = _prefix + "_original_sele" + _self.select(original_sele,selection) + + # Alter the segi to match the chain selection + chain_sele = "_chain_sele" + _self.select(chain_sele, f"chain {chain}") + _self.alter(chain_sele,f"segi = '{chain}'") + _self.delete(chain_sele) + + if not nascent.dbl_helix: + frag_string = nascent.fragment_name + _self.fragment(frag_string, tmp_editor, origin=0) + rename_three_to_one(nascent.nuc_acid, tmp_editor, nascent.nuc_type) + elif nascent.dbl_helix: + frag_string = nascent.nuc_acid + "_"+ _base_pair["DNA"][nascent.nuc_acid] + nascent.form + _self.fragment(frag_string, tmp_editor, origin=0) + else: + raise pymol.CmdException("No helix state selected") + + if _self.count_atoms(f"name {atom_selection_name}", domain=tmp_connect): + tmp_resv = iterate_to_list(tmp_connect,"resv") + + # Assign last res before adjustment is made + last_resv = int(tmp_resv[0]) + + if atom_selection_name == "O3'": + tmp_resv[0] = str(tmp_resv[0] + 1) + elif atom_selection_name == "P": + tmp_resv[0] = str(tmp_resv[0] - 1) + else: + raise pymol.CmdException("Something went wrong with resv loop in extend_nuc") + + # Resv and resi assignment and testing + resv = int(tmp_resv[0]) + resi = resv + + check_valid_attachment(nascent, atom_selection_name, selection, resv) + + reverse = False if atom_selection_name == "O3'" else True + + last_resi_sele = _prefix + "_last_resi" + _self.select(last_resi_sele, f"(byobject {selection}) & chain {chain} & resi \\{last_resv}") + + if not nascent.dbl_helix: + _self.alter(tmp_editor, f"chain='{chain}';segi='{chain}';resi=tmp_resv[0]", + space={'tmp_resv': tmp_resv}) + # Set parameters so that move_new_res can be used + prev_oppo_res = "none" + double_stranded_bool = False + + # Move and fuse + move_new_res(frag_string, tmp_editor, last_resi_sele, prev_oppo_res, double_stranded_bool, nascent.form, antisense=reverse) + _self.fuse(f"{tmp_editor} & name P", tmp_connect, mode=3) + + _self.select(tmp_domain, "byresi (pk1 | pk2)") + + if atom_selection_name == "O3'": + _self.bond(f"{tmp_domain} & resi \\{last_resv} & name O3'", + f"{tmp_domain} & resi \\{resv} & name P") + elif atom_selection_name == "P": + _self.bond(f"{tmp_domain} & resi \\{resv} & name O3'", + f"{tmp_domain} & resi \\{last_resv} & name P") + + elif nascent.dbl_helix: + #Initialize strings for selection + prev_oppo_res = _prefix + "_prev_oppo_res" + end_oppo_atom = _prefix + "_end_oppo_atom" + + #Initialize a double stranded bool for the detection of existing double strand + double_stranded_bool = False + base_pair_result = 0 + + # Get oppo information + atom_name_oppo = "O3'" if atom_selection_name == "P" else "P" + + # Get opposing chains and iterate looking for basepairs + chains_oppo = get_chains_oppo(chain, tmp_connect) + for tmp_chain_oppo in chains_oppo: + # Create selection strings + last_oppo_atom = _prefix + "_last_oppo_atom" + first_oppo_atom = _prefix + "_first_oppo_atom" + same_oppo_res = _prefix + "_same_oppo_atom" + + _self.select(last_oppo_atom, f"last (({object} and chain {tmp_chain_oppo} and (not {tmp_editor})) and polymer.nuc)") + _self.select(first_oppo_atom, f"first (({object} and chain {tmp_chain_oppo} and (not {tmp_editor})) and polymer.nuc)") + base_pair_last = check_DNA_base_pair(last_oppo_atom, original_sele) + base_pair_first = check_DNA_base_pair(first_oppo_atom, original_sele) + + same_base_flag = _self.select(same_oppo_res, f"({object} and (byres {last_oppo_atom}) and (byres {first_oppo_atom}))") + + if ((base_pair_first == 1 or base_pair_last == 1) and base_pair_result == 1 and same_base_flag == 0): + print("Multiple residues meet base pairing requirements. Building as if no opposing strand detected.") + base_pair_result = 0 + break + elif (base_pair_first == 1 and base_pair_last ==1): + chain_oppo = tmp_chain_oppo + base_pair_result = 1 + + check_DNA_base_pair(first_oppo_atom, original_sele) + atoms_first = iterate_to_list(_prefix + "_base_pair_dist","name") + check_DNA_base_pair(last_oppo_atom, original_sele) + atoms_last = iterate_to_list(_prefix + "_base_pair_dist", "name") + + if (len(atoms_first) > len(atoms_last)): + _self.select(end_oppo_atom,first_oppo_atom) + else: + _self.select(end_oppo_atom,last_oppo_atom) + + elif (base_pair_last == 1): + base_pair_result = 1 + chain_oppo = tmp_chain_oppo + _self.select(end_oppo_atom,last_oppo_atom) + elif (base_pair_first == 1): + base_pair_result = 1 + chain_oppo = tmp_chain_oppo + _self.select(end_oppo_atom,first_oppo_atom) + else: + print("No based pair was found on chain ", tmp_chain_oppo) + + if (base_pair_result == 1): + double_stranded_bool = True + # Confirm base pair result and set _base_pair_dist + check_DNA_base_pair(end_oppo_atom, original_sele) + + tmp_last_resv_oppo = iterate_to_list(end_oppo_atom,"resv") + if len(tmp_last_resv_oppo) == 1: + last_resv_oppo = tmp_last_resv_oppo[0] + else: + # This is arbitrary and may be changed. Using neg selected resv for now. + last_resv_oppo = -last_resv + + _self.select(prev_oppo_res, "byres (_tmp_editor_base_pair_dist)") + elif (base_pair_result == 0): + last_resv_oppo = -last_resv + chain_oppo = get_new_chain(chain, tmp_connect) + else: + raise pymol.CmdException("Base pairing result is not returning 0 or 1") + + # Alter the opposing segi to match chain + chain_oppo_sele = "_chain_oppo_sele" + _self.select(chain_oppo_sele, f"chain {chain_oppo}") + _self.alter(chain_oppo_sele,f"segi = '{chain_oppo}'") + _self.delete(chain_oppo_sele) + + # Get oppo resv value based on selection + if atom_selection_name == "O3'": + resv_oppo = last_resv_oppo - 1 + elif atom_selection_name == "P": + resv_oppo = last_resv_oppo + 1 + + # If picking O3', check O5' phosphate based on info found in this loop + if (atom_selection_name == "O3'" and double_stranded_bool == True): + tmp_phosphate_check = _prefix + "_phosphate_check" + + if(_self.select(tmp_phosphate_check, f"{prev_oppo_res} and name P ") == 0): + _self.select("pk1", f"{prev_oppo_res} and name O5'") + _self.select("pk2", f"{prev_oppo_res} and name O5'") # This is so attach frag has a pk2 + + attach_O5_phosphate() + + _self.unpick() + _self.select("pk1",original_sele) + _self.select(tmp_connect,f"{selection}") + _self.select(prev_oppo_res, f"byres ({prev_oppo_res})") + + if (_self.select(tmp_phosphate_check, f"{prev_oppo_res} and name P")==1): + print("Phosphate has been successfully added") + + # Move the fragment + move_new_res(frag_string, tmp_editor, last_resi_sele, prev_oppo_res, double_stranded_bool, nascent.form, antisense=reverse) + + # Alter residues created + _self.alter("_tmp_editor_newresA",f"chain='{chain}';segi='{chain}';resv={resv}") + _self.alter("_tmp_editor_newresB",f"chain='{chain_oppo}';segi='{chain_oppo}';resv={resv_oppo}") + + # Connect the created residues + if double_stranded_bool == True: + bond_double_stranded(tmp_editor, object, chain, chain_oppo, resv, resv_oppo, last_resi_sele, prev_oppo_res, + atom_selection_name, atom_name_oppo) + elif double_stranded_bool == False: + bond_single_stranded(tmp_editor, object, chain, resv, last_resi_sele, atom_selection_name, atom_name_oppo) + else: + raise pymol.CmdException("double_stranded_bool is not returning True or False") + + if nascent.nuc_type == "RNA": + add2pO(tmp_domain, nascent.nuc_acid, resv) + + new_term = _prefix + "_new_selection" + _self.select(new_term, f"{object} & chain {chain} & resi \\{resv} & name {atom_selection_name}") + #_self.edit(new_term) + def fab(input,name=None,mode='peptide',resi=1,chain='',segi='',state=-1, dir=1,hydro=-1,ss=0,async_=0,quiet=1,_self=cmd, **kwargs): ''' @@ -422,6 +1077,73 @@ def fab(input,name=None,mode='peptide',resi=1,chain='',segi='',state=-1, r = DEFAULT_SUCCESS return r +def fnab(input, name=None, mode="DNA", form="B", dbl_helix=1, *, _self=cmd): + """ +DESCRIPTION + + Builds a nucleotide acid from sequence + + Fragments provided by: + Lu, Xiang-Jun, Olson, Wilma K. 3DNA: a software package for the analysis, + rebuilding and visualization of three-dimensional nucleic acid structures, + Nucleic Acids Research, 32, W667-W675 (2004). + +USAGE + + fnab input [, name [, type [, form [, dbl_helix ]]]] + +ARGUMENTS + + input = str: Sequence as an array of one letter codes + + name = str: Name of the object to create {default: obj} + + mode = str: "DNA" or "RNA" + + form = str: "A" or "B" + + dbl_helix = bool (0/1): flag for using double helix in DNA + +EXAMPLE + + fnab ATGCGATAC + fnab ATGCGATAC, name=myDNA, mode=DNA, form=B, dbl_helix=1 + fnab AAUUUUCCG, mode=RNA + """ + _self.unpick() + + if name is None: + name = _self.get_unused_name(prefix="obj") + elif name in _self.get_names('all'): + name = _self.get_unused_name(prefix=name) + + dbl_helix = int(dbl_helix) > 0 + + mode = mode.upper() + if mode not in ('DNA', 'RNA'): + raise pymol.CmdException("\"mode\" must be \"DNA\" or \"RNA\" only.") + if mode == "RNA" and dbl_helix != 0: + print ("Double helix RNA building is not currently supported.") + dbl_helix = 0 + + #first pass for error checking + for oneNA in input: + oneNA = oneNA.upper() + threeNA = _oneNA_to_threeNA.get(oneNA) + if threeNA is None: + raise pymol.CmdException("\"%s\" not of %s type..." % (oneNA, mode)) + + if threeNA not in _base_pair[mode]: + raise pymol.CmdException("\"%s\" not of %s type..." % (oneNA, mode)) + + for oneNA in input: + oneNA = oneNA.upper() + threeNA = _oneNA_to_threeNA[oneNA] + attach_nuc_acid(selection="?pk1", nuc_acid=threeNA, nuc_type=mode, + object=name, form=form, dbl_helix=dbl_helix) + _self.unpick() + return DEFAULT_SUCCESS + def build_peptide(sequence,_self=cmd): # legacy for aa in sequence: attach_amino_acid("pk1",_aa_codes[aa]) diff --git a/modules/pymol/keywords.py b/modules/pymol/keywords.py index 8e4ce2bd1..fb8c8d022 100644 --- a/modules/pymol/keywords.py +++ b/modules/pymol/keywords.py @@ -83,6 +83,7 @@ def get_command_keywords(self_cmd=cmd): 'extract' : [ self_cmd.extract , 0 , 0 , '' , parsing.STRICT ], 'exec' : [ self_cmd.python_help , 0 , 0 , '' , parsing.PYTHON ], 'fab' : [ self_cmd.fab , 0 , 0 , '' , parsing.STRICT ], + 'fnab' : [ self_cmd.fnab , 0 , 0 , '' , parsing.STRICT ], 'feedback' : [ self_cmd.feedback , 0, 0 , '' , parsing.STRICT ], 'fetch' : [ self_cmd.fetch , 0, 0 , '' , parsing.STRICT ], 'fit' : [ self_cmd.fit , 0 , 0 , '' , parsing.STRICT ], diff --git a/testing/tests/api/build.py b/testing/tests/api/build.py index deb8c4803..ff2174278 100644 --- a/testing/tests/api/build.py +++ b/testing/tests/api/build.py @@ -3,7 +3,6 @@ """ from pymol import cmd, testing -@testing.requires('incentive') @testing.requires_version('2.3') class TestNucBuilder(testing.PyMOLTestCase): def testCanInit(self): From fb4e404202ab1c9dbdda849cb3dae6d1cc92bbbb Mon Sep 17 00:00:00 2001 From: Jarrett Johnson Date: Tue, 9 Apr 2024 12:59:46 -0400 Subject: [PATCH 02/17] 3.0.0 --- ChangeLog | 32 ++++++++++++++++++++++++++++++++ layer0/Version.h | 4 ++-- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8461eaf27..a882c80dc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,38 @@ CHANGE LOG ========================================================================= +2024-04-09 Jarrett Johnson, Thomas Stewart, Thomas Holder, Anton Butsev + + * 3.0.0 + + * Panels + - Nucleic Acid Builder supported + - Scenes Panel (Basic version) + - Improved APBS electrostatics plugin integrated + + * Distance/Bonding detection + - Halogen-bond detection and display + + * Python API + - `fnab` command (sequence to nucleic acid chain) + - Improved CGO builder API + - get_sasa_relative() `subsele` argument added + - new clip modes/API + - iterate() adds `explicit_valence` and `explicit_degree` + - `cell_centered` setting added + - by grid-cell background gradient `bg_gradient=2` + - look_at() added + - experimental `curve_new` / `move_on_curve` + + * Developer + - C++17 required + - pymol-testing integrated + - pytest introduced + - Github Actions CI + + * And many other fixes and small additions provided by developers + and the community... + 2021-05-10 Jarrett Johnson, Thomas Holder, Thomas Stewart * 2.5.0 diff --git a/layer0/Version.h b/layer0/Version.h index 32694e277..46f69c642 100644 --- a/layer0/Version.h +++ b/layer0/Version.h @@ -1,12 +1,12 @@ #ifndef _PyMOL_VERSION -#define _PyMOL_VERSION "2.6.0a0" +#define _PyMOL_VERSION "3.0.0" #endif /* for session file compatibility */ #ifndef _PyMOL_VERSION_int // X.Y.Z -> XYYYZZZ -#define _PyMOL_VERSION_int 2004000 +#define _PyMOL_VERSION_int 3000000 // Note: There should have never been a "double" version, it's // the least useful variant to specify a version. #define _PyMOL_VERSION_double (_PyMOL_VERSION_int / 1000000.) From 07199865816c368e6c979d7262b035f3852b5021 Mon Sep 17 00:00:00 2001 From: Jarrett Johnson Date: Tue, 9 Apr 2024 13:02:21 -0400 Subject: [PATCH 03/17] 3.1.0a0 version bump --- layer0/Version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layer0/Version.h b/layer0/Version.h index 46f69c642..33f377b92 100644 --- a/layer0/Version.h +++ b/layer0/Version.h @@ -1,5 +1,5 @@ #ifndef _PyMOL_VERSION -#define _PyMOL_VERSION "3.0.0" +#define _PyMOL_VERSION "3.1.0a0" #endif /* for session file compatibility */ From 1180fec3492c4d9072a3a3a34c2ff69f60885368 Mon Sep 17 00:00:00 2001 From: Jarrett Johnson Date: Wed, 10 Apr 2024 12:31:16 -0400 Subject: [PATCH 04/17] Replace makeshift C++17 with standard --- include/pymol/algorithm.h | 30 ++--------- include/pymol/functional.h | 20 -------- include/pymol/memory.h | 42 ---------------- include/pymol/tuple.h | 41 --------------- include/pymol/type_traits.h | 33 ++---------- layer0/Bezier.cpp | 6 +-- layer0/Event.h | 3 +- layer0/Map.cpp | 6 +-- layer0/MyPNG.cpp | 2 +- layer0/PostProcess.cpp | 6 +-- layer0/ShaderMgr.cpp | 2 +- layer1/CGO.cpp | 2 +- layer1/CGOGL.cpp | 2 +- layer1/Extrude.cpp | 2 +- layer1/Ortho.cpp | 4 +- layer1/SceneRay.cpp | 4 +- layer1/ScrollBar.cpp | 2 +- layer1/ScrollBar.h | 2 +- layer2/CoordSet.cpp | 4 +- layer2/ObjectCurve.cpp | 2 +- layer2/ObjectMap.cpp | 2 +- layer2/ObjectMolecule.cpp | 6 +-- layer2/ObjectMolecule2.cpp | 2 +- layer2/ObjectSurface.cpp | 2 +- layer2/RepDistLabel.cpp | 2 +- layer2/RepDot.cpp | 2 +- layer2/Sculpt.cpp | 2 +- layer3/Executive.cpp | 6 +-- layer3/Selector.cpp | 2 +- layerCTest/Test.h | 2 +- layerCTest/Test_Algorithm.cpp | 25 --------- layerCTest/Test_Functional_Utility.cpp | 70 -------------------------- layerCTest/Test_Result.cpp | 2 +- layerCTest/Test_type_traits.cpp | 10 ++-- 34 files changed, 50 insertions(+), 300 deletions(-) delete mode 100644 include/pymol/functional.h delete mode 100644 include/pymol/tuple.h delete mode 100644 layerCTest/Test_Functional_Utility.cpp diff --git a/include/pymol/algorithm.h b/include/pymol/algorithm.h index 91aed83ac..624a8fd83 100644 --- a/include/pymol/algorithm.h +++ b/include/pymol/algorithm.h @@ -27,30 +27,6 @@ template void erase_if(C& c, Pred pred) #endif } -/** - * @brief C++17's version of std::clamp - */ -template -const T& clamp(const T& value, const T& low, const T& high){ - assert(low <= high); - return std::max(low, std::min(value, high)); -} - -/** - * @brief C++14's std::equal - */ - -template -bool equal(InIter1 first1, InIter1 last1, InIter2 first2) -{ - for (; first1 != last1; ++first1, ++first2) { - if (*first1 != *first2) { - return false; - } - } - return true; -} - /** * @brief Checks whether two floating point values are nearly equal * @param first floating point number @@ -60,7 +36,7 @@ bool equal(InIter1 first1, InIter1 last1, InIter2 first2) * @tparam U second floating point type */ -template > +template > bool almost_equal(T a, U b, CommonT epsilon = 1e-6) { return std::abs(a - b) <= epsilon; @@ -136,7 +112,7 @@ bool equal(const RangeT1& first, const RangeT2& second) if (range1Size != range2Size) { return false; } - return pymol::equal(std::begin(first), std::end(first), std::begin(second)); + return std::equal(std::begin(first), std::end(first), std::begin(second)); } /** @@ -164,7 +140,7 @@ bool equal(const RangeT1& first, const RangeT2& second, Pred p) } } return true; - //return pymol::equal(std::begin(first), std::end(first), std::begin(second)); + //return std::equal(std::begin(first), std::end(first), std::begin(second)); } /** diff --git a/include/pymol/functional.h b/include/pymol/functional.h deleted file mode 100644 index c27bab52f..000000000 --- a/include/pymol/functional.h +++ /dev/null @@ -1,20 +0,0 @@ -#pragma once - -namespace pymol -{ - -/** - * C++17's invoke - * @param f Function to be invoked - * @param args arguments to supply to function - * Note: Does not return reference until C++14 - */ - -template -/*decltype(auto)*/ auto invoke(Func&& f, FuncArgs&&... args) - -> decltype(std::forward(f)(std::forward(args)...)) -{ - return std::forward(f)(std::forward(args)...); -} - -} // namespace pymol diff --git a/include/pymol/memory.h b/include/pymol/memory.h index d79d5a96c..23142ed00 100644 --- a/include/pymol/memory.h +++ b/include/pymol/memory.h @@ -6,48 +6,6 @@ namespace pymol { - -#if __cplusplus >= 201402L -using std::make_unique; -#else -/** - * @brief C++14's std::make_unique - * @param args arguments for constructor of Type T - * @return A std::unique_ptr for type T - */ - -template -std::unique_ptr make_unique(Args &&... args) { - return std::unique_ptr(new T(std::forward(args)...)); -} - -template ::value>> -std::unique_ptr make_unique(std::size_t size){ - return std::unique_ptr(new pymol::remove_extent_t[size]()); -} -#endif - -#if __cplusplus >= 201703L -using std::destroy_at; -using std::destroy; -#else -/* - * @brief C++17's std::destroy_at - */ -template void destroy_at(T* p) { p->~T(); } - -/* - * @brief C++17's std::destroy - */ - -template void destroy(T* iter, T* end) -{ - for(; iter != end; ++iter) { - destroy_at(std::addressof(*iter)); - } -} -#endif - /** * A copyable unique pointer. Will make a copy of the managed object with "new". */ diff --git a/include/pymol/tuple.h b/include/pymol/tuple.h deleted file mode 100644 index 556101711..000000000 --- a/include/pymol/tuple.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include "pymol/functional.h" -#include "pymol/type_traits.h" -#include "pymol/utility.h" - -namespace pymol -{ - -/* - * C++17's std::apply - * requires pymol::(or std::)index_sequence - * Takes a function and a tuple of lvalue/rvalue references to arguments - * and applys them to a function - */ - -namespace apply_detail -{ -template -/*decltype(auto)*/ auto apply_impl(Func&& f, TupleArgs&& t, - index_sequence) -> decltype(pymol::invoke(std::forward(f), - std::get(std::forward(t))...)) -{ - return pymol::invoke( - std::forward(f), std::get(std::forward(t))...); -} -} // namespace apply_detail - -template -/*decltype(auto)*/ auto apply(F&& f, TupleArgs&& t) -> decltype( - apply_detail::apply_impl(std::forward(f), std::forward(t), - make_index_sequence< - std::tuple_size>::value>{})) -{ - return apply_detail::apply_impl(std::forward(f), - std::forward(t), - make_index_sequence< - std::tuple_size>::value>{}); -} - -} // namespace pymol diff --git a/include/pymol/type_traits.h b/include/pymol/type_traits.h index 8135ebcad..8570dcd5a 100644 --- a/include/pymol/type_traits.h +++ b/include/pymol/type_traits.h @@ -6,43 +6,16 @@ namespace pymol { -template -using decay_t = typename std::decay::type; - -template -using enable_if_t = typename std::enable_if::type; - -template -using remove_reference_t = typename std::remove_reference::type; - -template -using remove_cv_t = typename std::remove_cv::type; - -template -using remove_cvref_t = remove_cv_t>; - -template -using remove_extent_t = typename std::remove_extent::type; - -template -using common_type_t = typename std::common_type::type; - -template -using result_of_t = typename std::result_of::type; - // Non-STL -template -using forward_check_t = pymol::enable_if_t, U>::value>; - //! Casts a pointer of type T to a pointer of type T[N] -template remove_reference_t reshape(T* flat) +template std::remove_reference_t reshape(T* flat) { return reinterpret_cast(flat); } //! Casts a pointer of type T[N] to a pointer of type T -template remove_extent_t* flatten(T* shaped) +template std::remove_extent_t* flatten(T* shaped) { - return reinterpret_cast*>(shaped); + return reinterpret_cast*>(shaped); } } diff --git a/layer0/Bezier.cpp b/layer0/Bezier.cpp index 584e5f38d..a1e2f0805 100644 --- a/layer0/Bezier.cpp +++ b/layer0/Bezier.cpp @@ -88,7 +88,7 @@ void BezierSpline::addBezierPoint() std::pair BezierSpline::getIndexAndLocalT(float globalT) const { - auto t = clamp(globalT, 0.0f, 1.0f); + auto t = std::clamp(globalT, 0.0f, 1.0f); if (t == 1.0f) { assert(bezierPoints.size() >= 2); return std::make_pair(static_cast(bezierPoints.size() - 2), t); @@ -108,7 +108,7 @@ glm::vec3 BezierSpline::GetBezierPoint( glm::vec3 BezierSpline::GetBezierPoint(const glm::vec3& p0, const glm::vec3& p1, const glm::vec3& p2, const glm::vec3& p3, float t) { - t = clamp(t, 0.0f, 1.0f); + t = std::clamp(t, 0.0f, 1.0f); float oneMinusT = 1.0f - t; return oneMinusT * oneMinusT * oneMinusT * p0 + 3.0f * oneMinusT * oneMinusT * t * p1 + 3.0f * oneMinusT * t * t * p2 + @@ -118,7 +118,7 @@ glm::vec3 BezierSpline::GetBezierPoint(const glm::vec3& p0, const glm::vec3& p1, glm::vec3 BezierSpline::GetBezierFirstDerivative(const glm::vec3& p0, const glm::vec3& p1, const glm::vec3& p2, const glm::vec3& p3, float t) { - t = clamp(t, 0.0f, 1.0f); + t = std::clamp(t, 0.0f, 1.0f); float oneMinusT = 1.0f - t; return 3.0f * oneMinusT * oneMinusT * (p1 - p0) + 6.0f * oneMinusT * t * (p2 - p1) + 3.0f * t * t * (p3 - p2); diff --git a/layer0/Event.h b/layer0/Event.h index 7c0e86911..3daa49f0f 100644 --- a/layer0/Event.h +++ b/layer0/Event.h @@ -2,7 +2,6 @@ #include #include -#include "pymol/functional.h" namespace pymol { @@ -19,7 +18,7 @@ template class Event return; } for (const auto& callback : m_callbacks) { - pymol::invoke(callback, params...); + std::invoke(callback, params...); } } diff --git a/layer0/Map.cpp b/layer0/Map.cpp index c74e714f0..e8aac4058 100644 --- a/layer0/Map.cpp +++ b/layer0/Map.cpp @@ -613,9 +613,9 @@ void MapLocus(const MapType * I, const float *v, int *a, int *b, int *c) bt = (int) ((v[1] - I->Min[1]) * invDiv) + MapBorder; ct = (int) ((v[2] - I->Min[2]) * invDiv) + MapBorder; - *a = pymol::clamp(at, I->iMin[0], I->iMax[0]); - *b = pymol::clamp(bt, I->iMin[1], I->iMax[1]); - *c = pymol::clamp(ct, I->iMin[2], I->iMax[2]); + *a = std::clamp(at, I->iMin[0], I->iMax[0]); + *b = std::clamp(bt, I->iMin[1], I->iMax[1]); + *c = std::clamp(ct, I->iMin[2], I->iMax[2]); } /** diff --git a/layer0/MyPNG.cpp b/layer0/MyPNG.cpp index 69331c77e..1707f3e22 100644 --- a/layer0/MyPNG.cpp +++ b/layer0/MyPNG.cpp @@ -497,7 +497,7 @@ std::unique_ptr MyPNGRead(const char *file_name) png_read_end(png_ptr, info_ptr); } - img = pymol::make_unique(width, height); + img = std::make_unique(width, height); if(ok) { auto p = img->bits(); for(row = 0; row < (signed) height; row++) { diff --git a/layer0/PostProcess.cpp b/layer0/PostProcess.cpp index d4a5c4db9..84a226d19 100644 --- a/layer0/PostProcess.cpp +++ b/layer0/PostProcess.cpp @@ -58,11 +58,11 @@ const renderTarget_t::shape_type PostProcess::size(std::size_t idx) const OIT_PostProcess::OIT_PostProcess(int width, int height, renderBuffer_t* rbo) { if (TM3_IS_ONEBUF) { - auto rt0 = pymol::make_unique(width, height); + auto rt0 = std::make_unique(width, height); rt0->layout({{4, rt_layout_t::FLOAT}}, rbo); m_renderTargets.push_back(std::move(rt0)); - auto rt1 = pymol::make_unique(width, height); + auto rt1 = std::make_unique(width, height); rt1->layout({{1, rt_layout_t::FLOAT}}, rt0->rbo()); m_renderTargets.push_back(std::move(rt1)); } else { @@ -74,7 +74,7 @@ OIT_PostProcess::OIT_PostProcess(int width, int height, renderBuffer_t* rbo) layouts.emplace_back(2, rt_layout_t::FLOAT); } - auto rt0 = pymol::make_unique(width, height); + auto rt0 = std::make_unique(width, height); rt0->layout(std::move(layouts), rbo); m_renderTargets.push_back(std::move(rt0)); } diff --git a/layer0/ShaderMgr.cpp b/layer0/ShaderMgr.cpp index 9fb73f3b3..726599872 100644 --- a/layer0/ShaderMgr.cpp +++ b/layer0/ShaderMgr.cpp @@ -1742,7 +1742,7 @@ void CShaderMgr::bindOffscreenOIT(int width, int height, int drawbuf) { renderTarget_t::shape_type req_size(width, height); if(!oit_pp || oit_pp->size() != req_size) { - oit_pp = pymol::make_unique( + oit_pp = std::make_unique( width, height, getGPUBuffer(offscreen_rt)->_rbo); } else { if (!TM3_IS_ONEBUF) { diff --git a/layer1/CGO.cpp b/layer1/CGO.cpp index 03e051d52..ff9dbf543 100644 --- a/layer1/CGO.cpp +++ b/layer1/CGO.cpp @@ -4103,7 +4103,7 @@ CGO *CGOOptimizeSpheresToVBONonIndexed(const CGO * I, int est, bool addshaders, CGO* CGOOptimizeBezier(const CGO* I) { - auto cgo = pymol::make_unique(I->G); + auto cgo = std::make_unique(I->G); int num_splines = CGOCountNumberOfOperationsOfType(I, CGO_BEZIER); auto vbo = I->G->ShaderMgr->newGPUBuffer(); std::vector vertData; diff --git a/layer1/CGOGL.cpp b/layer1/CGOGL.cpp index ed74b12fb..369bbced4 100644 --- a/layer1/CGOGL.cpp +++ b/layer1/CGOGL.cpp @@ -2537,7 +2537,7 @@ void CGORenderGLAlpha(CGO* I, RenderInfo* info, bool calcDepth) float* const pc = it.data(); assert(base < pc && pc < I->op + I->c); auto i = - pymol::clamp((pc[4] - I->z_min) * range_factor, 0, i_size); + std::clamp((pc[4] - I->z_min) * range_factor, 0, i_size); CGO_put_int(pc, start[i]); start[i] = (pc - base); /* NOTE: will always be > 0 since we have CGO_read_int'd */ diff --git a/layer1/Extrude.cpp b/layer1/Extrude.cpp index 857fcfe7d..a00201aee 100644 --- a/layer1/Extrude.cpp +++ b/layer1/Extrude.cpp @@ -627,7 +627,7 @@ void ExtrudeShiftToAxis(CExtrude* I, float radius, int sampling) float* avg = smoothed.data() + (a - 1) * 3; for (int j = -w2; j <= w2; ++j) { - int const k = pymol::clamp(a + j, 0, I->N - 1); + int const k = std::clamp(a + j, 0, I->N - 1); add3f(I->p + k * 3, avg, avg); } diff --git a/layer1/Ortho.cpp b/layer1/Ortho.cpp index fbdd49735..4adbead98 100644 --- a/layer1/Ortho.cpp +++ b/layer1/Ortho.cpp @@ -1319,7 +1319,7 @@ void OrthoBackgroundTextureNeedsUpdate(PyMOLGlobals * G){ static std::unique_ptr makeBgGridImage(PyMOLGlobals* G) { auto const& grid = G->Scene->grid; - auto tmpImg = pymol::make_unique( // + auto tmpImg = std::make_unique( // grid.n_col > 1 ? grid.n_col : 1, // grid.n_row > 1 ? grid.n_row : 1); @@ -1343,7 +1343,7 @@ static std::unique_ptr makeBgGradientImage(PyMOLGlobals* G) { constexpr unsigned height = BACKGROUND_TEXTURE_SIZE; - auto tmpImg = pymol::make_unique(1, height); + auto tmpImg = std::make_unique(1, height); float top[3], bottom[3], mixed[4]{0, 0, 0, 1}; copy3f(ColorGet(G, SettingGet_color(G, cSetting_bg_rgb_top)), top); diff --git a/layer1/SceneRay.cpp b/layer1/SceneRay.cpp index 7daedcea5..857067caa 100644 --- a/layer1/SceneRay.cpp +++ b/layer1/SceneRay.cpp @@ -336,7 +336,7 @@ bool SceneRay(PyMOLGlobals * G, switch (mode) { case 0: /* mode 0 is built-in */ { - auto image = pymol::make_unique(ray_width, ray_height); + auto image = std::make_unique(ray_width, ray_height); std::uint32_t background; RayRender(ray, image->pixels(), timing, angle, antialias, &background); @@ -346,7 +346,7 @@ bool SceneRay(PyMOLGlobals * G, I->Image = std::move(image); } else { if(!I->Image) { /* alloc on first pass */ - I->Image = pymol::make_unique(tot_width, tot_height); + I->Image = std::make_unique(tot_width, tot_height); if(I->Image) { unsigned int tot_size = tot_width * tot_height; { /* fill with background color */ diff --git a/layer1/ScrollBar.cpp b/layer1/ScrollBar.cpp index e8ce0100a..b73555f57 100644 --- a/layer1/ScrollBar.cpp +++ b/layer1/ScrollBar.cpp @@ -48,7 +48,7 @@ void ScrollBar::update() m_ValueMax = static_cast(m_ListSize - m_DisplaySize); if(m_ValueMax < 1) m_ValueMax = 1; - m_Value = pymol::clamp(m_Value, 0.0f, m_ValueMax); + m_Value = std::clamp(m_Value, 0.0f, m_ValueMax); } void ScrollBar::fill(CGO* orthoCGO) diff --git a/layer1/ScrollBar.h b/layer1/ScrollBar.h index 51a6be0e3..36d1a9ee6 100644 --- a/layer1/ScrollBar.h +++ b/layer1/ScrollBar.h @@ -61,7 +61,7 @@ class ScrollBar : public Block { bool isMaxed() const; void fill(CGO *orthoCGO); void setValueNoCheck(float _value) { m_Value = _value; } - void setValue(float _value){ m_Value = pymol::clamp(_value, 0.0f, m_ValueMax); } + void setValue(float _value){ m_Value = std::clamp(_value, 0.0f, m_ValueMax); } void drawNoFill(CGO *orthoCGO) { drawImpl(false, orthoCGO); } int grabbed() { return OrthoGrabbedBy(m_G, this); } float getValue() const { return m_Value; } diff --git a/layer2/CoordSet.cpp b/layer2/CoordSet.cpp index cd7066f51..cfa3a351c 100644 --- a/layer2/CoordSet.cpp +++ b/layer2/CoordSet.cpp @@ -1288,7 +1288,7 @@ void CoordSet::update(int state) auto use_shader = SettingGet(G, cSetting_use_shaders); if (use_shader) { auto color = ColorGet(G, Obj->Color); - auto preCGO = pymol::make_unique(G); + auto preCGO = std::make_unique(G); CGOColorv(preCGO.get(), color); CGOAppendNoStop(preCGO.get(), UnitCellCGO.get()); std::unique_ptr optimized(CGOOptimizeToVBONotIndexed(preCGO.get(), 0)); @@ -1507,7 +1507,7 @@ CoordSet::CoordSet(const CoordSet& cs) this->NTmpLinkBond = cs.NTmpLinkBond; /* deep copy & return ptr to new symmetry */ if(cs.Symmetry) { - this->Symmetry = pymol::make_unique(*cs.Symmetry); + this->Symmetry = std::make_unique(*cs.Symmetry); } std::copy(std::begin(cs.Name), std::end(cs.Name), std::begin(this->Name)); this->PeriodicBoxType = cs.PeriodicBoxType; diff --git a/layer2/ObjectCurve.cpp b/layer2/ObjectCurve.cpp index 0d1ee7324..4f73bfbbf 100644 --- a/layer2/ObjectCurve.cpp +++ b/layer2/ObjectCurve.cpp @@ -130,7 +130,7 @@ void ObjectCurveState::updateRawCGO() static CGO* FilterCGO(PyMOLGlobals* G, const CGO* rawCGO) { - auto optCGO = pymol::make_unique(G); + auto optCGO = std::make_unique(G); CGO* allCylinders = nullptr; CGO* allBeziers = nullptr; CGO* allSpheres = nullptr; diff --git a/layer2/ObjectMap.cpp b/layer2/ObjectMap.cpp index bfe2a25f5..8c192e8a1 100644 --- a/layer2/ObjectMap.cpp +++ b/layer2/ObjectMap.cpp @@ -4886,7 +4886,7 @@ static pymol::Result> ObjectMapDXStrToMap( char cc[MAXLINELEN]; - auto ms = pymol::make_unique(G); + auto ms = std::make_unique(G); ms->Origin = std::vector(3); ms->Grid = std::vector(3); diff --git a/layer2/ObjectMolecule.cpp b/layer2/ObjectMolecule.cpp index 3c435d649..1479e5ba1 100644 --- a/layer2/ObjectMolecule.cpp +++ b/layer2/ObjectMolecule.cpp @@ -1103,7 +1103,7 @@ ObjectMolecule *ObjectMoleculeLoadTRJFile(PyMOLGlobals * G, ObjectMolecule * I, if(sscanf(cc, "%f", &angle[2]) != 1) angles = false; if(periodic) { - cs->Symmetry = pymol::make_unique(G); + cs->Symmetry = std::make_unique(G); cs->Symmetry->Crystal.setDims(box); if(angles) { cs->Symmetry->Crystal.setAngles(angle); @@ -2171,7 +2171,7 @@ static CoordSet *ObjectMoleculeTOPStr2CoordSet(PyMOLGlobals * G, const char *buf angle[2] = 60.0; } - cset->Symmetry = pymol::make_unique(G); + cset->Symmetry = std::make_unique(G); cset->Symmetry->Crystal.setDims(BOX1, BOX2, BOX3); cset->Symmetry->Crystal.setAngles(angle); } @@ -3259,7 +3259,7 @@ pymol::Result<> ObjectMoleculeFuse(ObjectMolecule* I, int const index0, } /* copy atoms and atom info into a 1:1 direct mapping */ - auto cs = pymol::make_unique(G); + auto cs = std::make_unique(G); cs->setNIndex(scs->NIndex); cs->enumIndices(); diff --git a/layer2/ObjectMolecule2.cpp b/layer2/ObjectMolecule2.cpp index 8c879e3a5..857876a92 100644 --- a/layer2/ObjectMolecule2.cpp +++ b/layer2/ObjectMolecule2.cpp @@ -3743,7 +3743,7 @@ bool ObjectMoleculeConnect(ObjectMolecule* I, int& nBond, pymol::vla& // For monitoring excessive numbers of bonds int violations = 0; auto const max_violations = cs->NIndex >> 3; // 12% - auto const cnt = pymol::make_unique(size_t(cs->NIndex)); + auto const cnt = std::make_unique(size_t(cs->NIndex)); p_return_val_if_fail(cnt, false); // memory error /* initialize each atom's (max) expected valence */ diff --git a/layer2/ObjectSurface.cpp b/layer2/ObjectSurface.cpp index fd6ec1bc2..3a8e90762 100644 --- a/layer2/ObjectSurface.cpp +++ b/layer2/ObjectSurface.cpp @@ -873,7 +873,7 @@ static void ObjectSurfaceRenderCell(PyMOLGlobals *G, ObjectSurface * I, const float *color = ColorGet(G, I->Color); if (use_shader != ms->UnitCellCGO->has_draw_buffers){ if (use_shader){ - auto preCGO = pymol::make_unique(G); + auto preCGO = std::make_unique(G); CGOColorv(preCGO.get(), color); CGOAppendNoStop(preCGO.get(), ms->UnitCellCGO.get()); std::unique_ptr optimized(CGOOptimizeToVBONotIndexed(preCGO.get(), 0)); diff --git a/layer2/RepDistLabel.cpp b/layer2/RepDistLabel.cpp index e11bf4e34..9b5ee943f 100644 --- a/layer2/RepDistLabel.cpp +++ b/layer2/RepDistLabel.cpp @@ -247,7 +247,7 @@ Rep *RepDistLabelNew(DistSet * ds, int state) return nullptr; } - default_digits = pymol::clamp(default_digits, 0, 10); + default_digits = std::clamp(default_digits, 0, 10); auto I = new RepDistLabel(ds->Obj, state); diff --git a/layer2/RepDot.cpp b/layer2/RepDot.cpp index 60c7021a2..38a4d1e23 100644 --- a/layer2/RepDot.cpp +++ b/layer2/RepDot.cpp @@ -298,7 +298,7 @@ Rep *RepDotDoNew(CoordSet * cs, cRepDot_t mode, int state) // get current dot sampling // Note: significantly affects the accuracy of our area comp. auto ds = SettingGet(G, cs->Setting.get(), obj->Setting.get(), cSetting_dot_density); - SphereRec const* sp = G->Sphere->Sphere[pymol::clamp(ds, 0, 4)]; + SphereRec const* sp = G->Sphere->Sphere[std::clamp(ds, 0, 4)]; int lastColor = cColorDefault; int colorCnt = 0; diff --git a/layer2/Sculpt.cpp b/layer2/Sculpt.cpp index e4036cc01..4ee4b2d79 100644 --- a/layer2/Sculpt.cpp +++ b/layer2/Sculpt.cpp @@ -235,7 +235,7 @@ static float ShakerDoDistMinim(float target, float *v0, float *v1, float *d0to1, CSculpt::CSculpt (PyMOLGlobals * G) { this->G = G; - this->Shaker = pymol::make_unique(G); + this->Shaker = std::make_unique(G); this->NBList = pymol::vla(150000); this->NBHash = std::vector(NB_HASH_SIZE); this->EXList = pymol::vla(100000); diff --git a/layer3/Executive.cpp b/layer3/Executive.cpp index 4a8371166..22d0d4e93 100644 --- a/layer3/Executive.cpp +++ b/layer3/Executive.cpp @@ -5560,7 +5560,7 @@ int ExecutiveSetSession(PyMOLGlobals * G, PyObject * session, if (partial_restore) { G->SettingUnique->old2new = - pymol::make_unique>(); + std::make_unique>(); } if(ok) { @@ -16834,7 +16834,7 @@ pymol::Result<> ExecutiveCurveNew(PyMOLGlobals* G, if (oldObj) { return pymol::make_error("Curve of this name already exists."); } - auto obj = pymol::make_unique(G); + auto obj = std::make_unique(G); obj->setName(curveName); ExecutiveManageObject(G, obj.release(), false, true); return {}; @@ -16893,7 +16893,7 @@ static pymol::Result<> ExecutiveMoveCameraOnCurve( pymol::Result<> ExecutiveMoveOnCurve(PyMOLGlobals* G, pymol::zstring_view mobileObjectName, pymol::zstring_view curveObjectName, float t) { - t = pymol::clamp(t, 0.0f, 1.0f); + t = std::clamp(t, 0.0f, 1.0f); auto curveObj = ExecutiveFindObject(G, curveObjectName); if (!curveObj) { return pymol::make_error("Curve object not found."); diff --git a/layer3/Selector.cpp b/layer3/Selector.cpp index 6dff06b51..432ed8bb6 100644 --- a/layer3/Selector.cpp +++ b/layer3/Selector.cpp @@ -1357,7 +1357,7 @@ MapType *SelectorGetSpacialMapFromSeleCoord(PyMOLGlobals * G, int sele, int stat if(sele < 0) return NULL; else { - auto ptr = pymol::make_unique(G, G->SelectorMgr); + auto ptr = std::make_unique(G, G->SelectorMgr); CSelector mapSele(G, G->SelectorMgr); auto I = &mapSele; SelectorUpdateTableImpl(G, I, state, -1); diff --git a/layerCTest/Test.h b/layerCTest/Test.h index 92c3b1c88..63016d44b 100644 --- a/layerCTest/Test.h +++ b/layerCTest/Test.h @@ -58,7 +58,7 @@ static bool isArrayZero(const T *arr, const std::size_t len) { // Checks whether arrays are equal template static bool isArrayEqual(const T *arr1, const T *arr2, const std::size_t len) { - return pymol::equal(arr1, arr1 + len, arr2); + return std::equal(arr1, arr1 + len, arr2); } // Checks whether type has all special member functions diff --git a/layerCTest/Test_Algorithm.cpp b/layerCTest/Test_Algorithm.cpp index 3df425e7e..071184290 100644 --- a/layerCTest/Test_Algorithm.cpp +++ b/layerCTest/Test_Algorithm.cpp @@ -4,31 +4,6 @@ #include "pymol/algorithm.h" -TEST_CASE("Clamp", "[Algorithm]") -{ - REQUIRE(pymol::clamp(-1, 0, 10) == 0); - REQUIRE(pymol::clamp(3, 0, 10) == 3); - REQUIRE(pymol::clamp(13, 0, 10) == 10); -} - -TEST_CASE("Equal", "[Algorithm]") -{ - std::vector a{1, 2, 3, 4}; - std::vector b{1, 2, 3, 4, 5}; - REQUIRE(pymol::equal(a.begin(), a.end(), b.begin())); - b[3] = 42; - REQUIRE(!pymol::equal(a.begin(), a.end(), b.begin())); -} - -TEST_CASE("Almost Equal", "[Algorithm]") -{ - std::vector a{1, 2, 3, 4}; - std::vector b{1, 2, 3, 4, 5}; - REQUIRE(pymol::equal(a.begin(), a.end(), b.begin())); - b[3] = 42; - REQUIRE(!pymol::equal(a.begin(), a.end(), b.begin())); -} - TEST_CASE("Range Equal", "[Algorithm]") { std::array a{1, 2, 3, 4}; diff --git a/layerCTest/Test_Functional_Utility.cpp b/layerCTest/Test_Functional_Utility.cpp deleted file mode 100644 index cf0f18d31..000000000 --- a/layerCTest/Test_Functional_Utility.cpp +++ /dev/null @@ -1,70 +0,0 @@ -#include - -#include "pymol/tuple.h" -#include "pymol/functional.h" -#include "Test.h" - -TEST_CASE("Integer Sequence", "[FuncUtil]") -{ - pymol::integer_sequence intSeq; - static_assert(intSeq.size() == 4, "Incorrect integer sequence size"); - REQUIRE(intSeq.size() == 4); -} - -TEST_CASE("Make Integer Sequence", "[FuncUtil]") -{ - auto intSeq = pymol::make_integer_sequence(); - static_assert(intSeq.size() == 10, "Incorrect integer sequence size"); - REQUIRE(intSeq.size() == 10); -} - -TEST_CASE("Index Sequence", "[FuncUtil]") -{ - pymol::index_sequence<0, 1, 2, 3, 4, 5> idxSeq; - static_assert(idxSeq.size() == 6, "Incorrect integer sequence size"); - REQUIRE(idxSeq.size() == 6); -} - -TEST_CASE("Make Index Sequence", "[FuncUtil]") -{ - auto idxSeq = pymol::make_index_sequence<10>(); - static_assert(idxSeq.size() == 10, "Incorrect integer sequence size"); - REQUIRE(idxSeq.size() == 10); -} - -TEST_CASE("Index Sequence For", "[FuncUtil]") -{ - auto idxSeq = pymol::index_sequence_for(); - static_assert(idxSeq.size() == 3, "Incorrect integer sequence size"); - REQUIRE(idxSeq.size() == 3); -} - -constexpr int constexprFunc() -{ - return 42; -}; - -TEST_CASE("Invoke", "[FuncUtil]") -{ - auto returnValue = constexprFunc(); - auto returnValue2 = pymol::invoke(constexprFunc); - static_assert(std::is_same::value, ""); - static_assert(std::is_same::value, ""); - static_assert(constexprFunc() == 42, "Incorrect result"); - REQUIRE(std::is_same::value); - REQUIRE(std::is_same::value); - REQUIRE(constexprFunc() == 42); - REQUIRE(pymol::invoke(constexprFunc) == 42); -} - -int applyme(std::string& s, int, float) -{ - return 42; -} - -TEST_CASE("Apply", "[FuncUtil]") -{ - std::string s{"Hello World"}; - auto value = pymol::apply(applyme, std::forward_as_tuple(s, 100, 3.14f)); - REQUIRE(value == 42); -} diff --git a/layerCTest/Test_Result.cpp b/layerCTest/Test_Result.cpp index 6187f06ec..40d450253 100644 --- a/layerCTest/Test_Result.cpp +++ b/layerCTest/Test_Result.cpp @@ -21,7 +21,7 @@ TEST_CASE("Result simple", "[Result]") template static -pymol::Result> sum(T i, U j) +pymol::Result> sum(T i, U j) { return i + j; } diff --git a/layerCTest/Test_type_traits.cpp b/layerCTest/Test_type_traits.cpp index 578596ffc..e4161462a 100644 --- a/layerCTest/Test_type_traits.cpp +++ b/layerCTest/Test_type_traits.cpp @@ -12,17 +12,17 @@ TEST_CASE("reshape", "[type_traits]") f3array* foo = shaped; static_assert(std::is_same::value, ""); - REQUIRE(pymol::equal(shaped[0], shaped[0] + 3, flat + 0)); - REQUIRE(pymol::equal(shaped[1], shaped[1] + 3, flat + 3)); + REQUIRE(std::equal(shaped[0], shaped[0] + 3, flat + 0)); + REQUIRE(std::equal(shaped[1], shaped[1] + 3, flat + 3)); } TEST_CASE("flatten", "[type_traits]") { float shaped[2][3] = {{1.f, 2.f, 3.f}, {4.f, 5.f, 6.f}}; const float* flat = pymol::flatten(shaped); - REQUIRE(pymol::equal(shaped[0], shaped[0] + 3, flat + 0)); - REQUIRE(pymol::equal(shaped[1], shaped[1] + 3, flat + 3)); + REQUIRE(std::equal(shaped[0], shaped[0] + 3, flat + 0)); + REQUIRE(std::equal(shaped[1], shaped[1] + 3, flat + 3)); auto* shaped_ptr = shaped; float* flat_from_ptr = pymol::flatten(shaped_ptr); - REQUIRE(pymol::equal(flat, flat + 6, flat_from_ptr)); + REQUIRE(std::equal(flat, flat + 6, flat_from_ptr)); } From 0b925f7ab0dae5229c51a4ab0d726662961c1b95 Mon Sep 17 00:00:00 2001 From: Jarrett Johnson Date: Sat, 11 May 2024 01:01:31 -0400 Subject: [PATCH 05/17] Trigger CI on PRs too --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b127e44a0..7b8ba0b31 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: CI -on: [push] +on: [push, pull_request] jobs: build: From 195f4d18d70c136c595b38d4ce16c6e225d0a49e Mon Sep 17 00:00:00 2001 From: Jarrett Johnson Date: Sat, 11 May 2024 01:07:07 -0400 Subject: [PATCH 06/17] Address some compilation errors --- layer1/CGO.cpp | 2 +- layer1/CGO.h | 3 ++- layer2/RepCartoon.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/layer1/CGO.cpp b/layer1/CGO.cpp index ff9dbf543..e5aaa0594 100644 --- a/layer1/CGO.cpp +++ b/layer1/CGO.cpp @@ -145,7 +145,7 @@ void AssignNewPickColor(CGO* cgo, PickColorManager* pickmgr, pickmgr->colorNext(color, context, index, bond); } -int CGO_sz[] = { +std::size_t CGO_sz[] = { CGO_NULL_SZ, CGO_NULL_SZ, CGO_BEGIN_SZ, diff --git a/layer1/CGO.h b/layer1/CGO.h index 023ed6817..e23c83f1c 100644 --- a/layer1/CGO.h +++ b/layer1/CGO.h @@ -32,6 +32,7 @@ Z* ------------------------------------------------------------------- #include #include #include +#include /* Compiled Graphics Library for simple graphics objects in floating point three-space, with the goal of achieving @@ -272,7 +273,7 @@ inline uchar CLIP_NORMAL_VALUE(float cv){ return ((cv>1.f) ? 127 : #define CGO_ACCESSIBILITY_ARRAY 0x10 #define CGO_TEX_COORD_ARRAY 0x20 -extern int CGO_sz[]; +extern std::size_t CGO_sz[]; size_t CGO_sz_size(); // I think CGO rendering functions should not modify CGO's, so the diff --git a/layer2/RepCartoon.cpp b/layer2/RepCartoon.cpp index a2c89b454..813d3af3c 100644 --- a/layer2/RepCartoon.cpp +++ b/layer2/RepCartoon.cpp @@ -1001,7 +1001,7 @@ static void do_ring(PyMOLGlobals * G, nuc_acid_data *ndata, int n_atom, color2 = ColorGet(G, g2_ai->color); } CGOPickColor(cgo, g1, g1_ai->masked ? cPickableNoPick : cPickableAtom); - Pickable pickcolor2 = { g2, g2_ai->masked ? cPickableNoPick : cPickableAtom }; + Pickable pickcolor2 = { static_cast(g2), g2_ai->masked ? cPickableNoPick : cPickableAtom }; float axis[3]; subtract3f(g2p, g1p, axis); CGOColorv(cgo, color1); @@ -1046,7 +1046,7 @@ static void do_ring(PyMOLGlobals * G, nuc_acid_data *ndata, int n_atom, color2 = ColorGet(G, bas_ai->color); } CGOPickColor(cgo, sugar_at, sug_ai->masked ? cPickableNoPick : cPickableAtom); - Pickable pickcolor2 = { base_at, bas_ai->masked ? cPickableNoPick : cPickableAtom }; + Pickable pickcolor2 = { static_cast(base_at), bas_ai->masked ? cPickableNoPick : cPickableAtom }; float axis[3]; subtract3f(cs->coordPtr(bas), cs->coordPtr(sug), axis); CGOColorv(cgo, color1); @@ -1103,7 +1103,7 @@ static void do_ring(PyMOLGlobals * G, nuc_acid_data *ndata, int n_atom, } CGOPickColor(cgo, sugar_at, sug_ai->masked ? cPickableNoPick : cPickableAtom); - Pickable pickcolor2 = { base_at, bas_ai->masked ? cPickableNoPick : cPickableAtom }; + Pickable pickcolor2 = { static_cast(base_at), bas_ai->masked ? cPickableNoPick : cPickableAtom }; float axis[3]; subtract3f(cs->coordPtr(bas), v_outer, axis); CGOColorv(cgo, color1); @@ -1347,7 +1347,7 @@ static void do_ring(PyMOLGlobals * G, nuc_acid_data *ndata, int n_atom, color1 = color2 = color; } CGOPickColor(cgo, atix[i], ai_i[i]->masked ? cPickableNoPick : cPickableAtom); - Pickable pickcolor2 = { atix[ii], ai_i[ii]->masked ? cPickableNoPick : cPickableAtom }; + Pickable pickcolor2 = { static_cast(atix[ii]), ai_i[ii]->masked ? cPickableNoPick : cPickableAtom }; float axis[3]; subtract3f(v_i[ii], v_i[i], axis); CGOColorv(cgo, color1); From 3d3c8963798d426e70675c3c40df146e12869b0a Mon Sep 17 00:00:00 2001 From: Branch Vincent Date: Fri, 10 May 2024 22:12:58 -0700 Subject: [PATCH 07/17] replace distutils for python 3.12 (#362) Co-authored-by: Jarrett Johnson --- create_shadertext.py | 3 +-- modules/pymol/plugins/installation.py | 7 +++---- testing/tests/system/pymolwin.py | 1 - 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/create_shadertext.py b/create_shadertext.py index 7bae72180..f6857087e 100644 --- a/create_shadertext.py +++ b/create_shadertext.py @@ -7,7 +7,6 @@ from collections import defaultdict from os.path import dirname from subprocess import Popen, PIPE -from distutils import dir_util def create_all(generated_dir, pymoldir="."): ''' @@ -30,7 +29,7 @@ def __init__(self, filename): self.out = cStringIO.StringIO() self.filename = filename else: - dir_util.mkpath(os.path.dirname(filename)) + os.makedirs(os.path.dirname(filename), exist_ok=True) self.out = open(filename, "w") self.filename = None def close(self): diff --git a/modules/pymol/plugins/installation.py b/modules/pymol/plugins/installation.py index 3a980545b..2fb8f6f03 100644 --- a/modules/pymol/plugins/installation.py +++ b/modules/pymol/plugins/installation.py @@ -45,8 +45,6 @@ def cmp_version(v1, v2): ''' Compares two version strings. An empty version string is always considered smaller than a non-empty version string. - - Uses distutils.version.StrictVersion to evaluate non-empty version strings. ''' if v1 == v2: return 0 @@ -55,8 +53,9 @@ def cmp_version(v1, v2): if v2 == '': return 1 try: - from distutils.version import StrictVersion as Version - return cmp(Version(v1), Version(v2)) + v1_parts = list(map(int, v1.split('.'))) + v2_parts = list(map(int, v2.split('.'))) + return (v1_parts > v2_parts) - (v1_parts < v2_parts) except: print(' Warning: Version parsing failed for', v1, 'and/or', v2) return 0 diff --git a/testing/tests/system/pymolwin.py b/testing/tests/system/pymolwin.py index 429fd28aa..e7885bd38 100644 --- a/testing/tests/system/pymolwin.py +++ b/testing/tests/system/pymolwin.py @@ -7,7 +7,6 @@ import subprocess import sys import unittest -from distutils.spawn import find_executable from pymol import cmd, CmdException, testing, stored @unittest.skipIf(not sys.platform.startswith('win'), 'windows only') From 1e9d81d6d2f16faab9dcb76fbf159cc5bccc4a3a Mon Sep 17 00:00:00 2001 From: Jarrett Johnson Date: Sat, 11 May 2024 10:32:33 -0400 Subject: [PATCH 08/17] Fix GIL for CmdGetCCP4Str --- layer4/Cmd.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/layer4/Cmd.cpp b/layer4/Cmd.cpp index 02b4a1e2f..20b9ca263 100644 --- a/layer4/Cmd.cpp +++ b/layer4/Cmd.cpp @@ -693,12 +693,12 @@ static PyObject * CmdGetCCP4Str(PyObject * self, PyObject * args) } else { API_SETUP_PYMOL_GLOBALS; if (G) { - APIEnter(G); + APIEnterBlocked(G); auto v = ObjectMapGetCCP4Str(G, name, state, quiet, format); PyObject * result = v.empty() ? NULL : PyBytes_FromStringAndSize(&v.front(), v.size()); - APIExit(G); + APIExitBlocked(G); return APIAutoNone(result); } } From 5f0106a096c6b235f40f7cdaab54c51bc0989e9f Mon Sep 17 00:00:00 2001 From: Jarrett Johnson Date: Sat, 11 May 2024 14:18:09 -0400 Subject: [PATCH 09/17] Fix champ mem alloc file buffer overflow --- contrib/champ/os_memory.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/contrib/champ/os_memory.c b/contrib/champ/os_memory.c index cc26984f9..5b38ccfa4 100644 --- a/contrib/champ/os_memory.c +++ b/contrib/champ/os_memory.c @@ -176,7 +176,15 @@ void *OSMemoryMalloc(unsigned int size,const char *file,int line,int type) rec=(DebugRec*)malloc(sizeof(DebugRec)+size); if(!rec) return(NULL); - strcpy(rec->file,file); + + int len = strlen(file); + int max_size = sizeof(rec->file) - 1; + if (len > max_size) { + strcpy(rec->file, file + len - max_size); + } else { + strcpy(rec->file, file); + } + rec->file[max_size - 1] = '\0'; rec->line=line; rec->size=size; rec->type=type; @@ -196,7 +204,15 @@ void *OSMemoryCalloc(unsigned int count,unsigned int size,const char *file,int l rec=(DebugRec*)calloc(1,sizeof(DebugRec)+size); if(!rec) return(NULL); - strcpy(rec->file,file); + + int len = strlen(file); + int max_size = sizeof(rec->file) - 1; + if (len > max_size) { + strcpy(rec->file, file + len - max_size); + } else { + strcpy(rec->file, file); + } + rec->file[max_size - 1] = '\0'; rec->line=line; rec->size=size; rec->type=type; From 63b7438b96089346478e5df33abe6783f032a57c Mon Sep 17 00:00:00 2001 From: Jarrett Johnson Date: Sat, 11 May 2024 20:08:09 -0400 Subject: [PATCH 10/17] ok assignment breaks tests on Windows --- layer2/ObjectMolecule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layer2/ObjectMolecule.cpp b/layer2/ObjectMolecule.cpp index 1479e5ba1..1f6f23bc4 100644 --- a/layer2/ObjectMolecule.cpp +++ b/layer2/ObjectMolecule.cpp @@ -2388,7 +2388,7 @@ static ObjectMolecule *ObjectMoleculeReadTOPStr(PyMOLGlobals * G, ObjectMolecule */ if(ok && isNew) - ok &= ObjectMoleculeConnect(I, cset, false); + ok = ObjectMoleculeConnect(I, cset, false); if(cset->Symmetry && (!I->Symmetry)) { I->Symmetry.reset(new CSymmetry(*cset->Symmetry)); CHECKOK(ok, I->Symmetry); From a4cc70c2ff6406bd1b9ffb713fad00cac117e7fe Mon Sep 17 00:00:00 2001 From: Jarrett Johnson Date: Sun, 12 May 2024 12:20:12 -0400 Subject: [PATCH 11/17] Add CI for Windows and Mac --- .github/workflows/build.yml | 92 ++++++++++++++++++++++++++++++++-- setup.py | 24 +++++---- testing/tests/api/externing.py | 14 +++++- 3 files changed, 115 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b8ba0b31..f9953c74f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,18 +3,19 @@ name: CI on: [push, pull_request] jobs: - build: + build-Linux: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4.0.0 - name: Install system dependencies run: > sudo apt-get update; sudo apt-get --no-install-recommends install catch2 + cmake libfreetype6-dev libglew-dev libglm-dev @@ -25,7 +26,7 @@ jobs: python-is-python3 python3-biopython python3-dev - python3-distutils + python3-setuptools python3-numpy python3-pil python3-pytest @@ -49,3 +50,88 @@ jobs: - name: Test run: | ./install-prefix/bin/pymol -ckqy testing/testing.py --run all + + build-Windows: + + runs-on: windows-latest + + env: + CONDA_ROOT: ${{github.workspace}}\..\tmp\mambaforge + MAMBAFORGE_EXEC: ${{github.workspace}}\..\tmp\mambaforge.exe + + steps: + - uses: actions/checkout@v4.0.0 + - name: Download miniconda + shell: cmd + run: |- + if not exist %CONDA_ROOT% mkdir %CONDA_ROOT% + curl -L -o %MAMBAFORGE_EXEC% https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Mambaforge-24.3.0-0-Windows-x86_64.exe + start /wait %MAMBAFORGE_EXEC% /S /D=%CONDA_ROOT% + + - name: Set up Miniconda + shell: cmd + run: |- + CALL %CONDA_ROOT%\\Scripts\\activate.bat + conda install -y -c conda-forge -c schrodinger python cmake libpng freetype pyqt glew libxml2 numpy catch2=2.13.3 glm libnetcdf collada2gltf biopython pillow msgpack-python pytest + + - name: Conda info + shell: cmd + run: |- + CALL %CONDA_ROOT%\\Scripts\\activate.bat + conda info + + - name: Get additional sources + shell: cmd + run: | + git clone --depth 1 https://github.com/rcsb/mmtf-cpp.git + cp -R mmtf-cpp/include/mmtf* %CONDA_ROOT%/Library/include/ + git clone --depth 1 --single-branch --branch cpp_master https://github.com/msgpack/msgpack-c.git + cp -R msgpack-c/include/msgpack* %CONDA_ROOT%/Library/include/ + + - name: Build PyMOL + shell: cmd + run: | + CALL %CONDA_ROOT%\\Scripts\\activate.bat + python setup.py --testing install --prefix=%GITHUB_WORKSPACE%\\install-prefix + + - name: Test + shell: cmd + run: | + CALL %CONDA_ROOT%\\Scripts\\activate.bat + %GITHUB_WORKSPACE%\\install-prefix\\Scripts\\pymol.bat -ckqy testing\\testing.py --run all + + build-MacOS: + + runs-on: macos-latest + + env: + CONDA_ROOT: "/tmp/miniconda" + + steps: + - uses: actions/checkout@v4.0.0 + - name: Set up Miniconda and Build + run: |- + curl -L -o $CONDA_ROOT.sh https://github.com/conda-forge/miniforge/releases/download/24.3.0-0/Mambaforge-MacOSX-x86_64.sh + bash $CONDA_ROOT.sh -b -p $CONDA_ROOT + export PATH="$CONDA_ROOT/bin:$PATH" + conda config --set quiet yes + conda install -y -c conda-forge -c schrodinger python cmake libpng freetype pyqt glew libxml2 numpy catch2=2.13.3 glm libnetcdf collada2gltf biopython pillow msgpack-python pytest + conda info + + - name: Get additional sources + run: | + git clone --depth 1 https://github.com/rcsb/mmtf-cpp.git + cp -R mmtf-cpp/include/mmtf* ${CONDA_ROOT}/include/ + git clone --depth 1 --single-branch --branch cpp_master https://github.com/msgpack/msgpack-c.git + cp -R msgpack-c/include/msgpack* ${CONDA_ROOT}/include/ + + - name: Build PyMOL + run: |- + export MACOSX_DEPLOYMENT_TARGET=12.0 + export PATH="$CONDA_ROOT/bin:$PATH" + python setup.py install --prefix=${GITHUB_WORKSPACE}/install-prefix + + - name: Test + run: |- + export PATH="$CONDA_ROOT/bin:$PATH" + ${GITHUB_WORKSPACE}/install-prefix/bin/pymol -ckqy testing/testing.py --run all diff --git a/setup.py b/setup.py index 807edc1db..eb18dd137 100644 --- a/setup.py +++ b/setup.py @@ -121,17 +121,18 @@ def is_conda_env(): def guess_msgpackc(): for prefix in prefix_path: - f = os.path.join(prefix, 'include', 'msgpack', 'version_master.h') + for suffix in ['h', 'hpp']: + f = os.path.join(prefix, 'include', 'msgpack', f'version_master.{suffix}') - try: - m = re.search(r'MSGPACK_VERSION_MAJOR\s+(\d+)', open(f).read()) - except EnvironmentError: - continue + try: + m = re.search(r'MSGPACK_VERSION_MAJOR\s+(\d+)', open(f).read()) + except EnvironmentError: + continue - if m is not None: - major = int(m.group(1)) - if major > 1: - return 'c++11' + if m is not None: + major = int(m.group(1)) + if major > 1: + return 'c++11' return 'no' @@ -348,7 +349,10 @@ def make_launch_script(self): def_macros += [("_PYMOL_NO_MSGPACKC", None)] else: if options.use_msgpackc == 'c++11': - def_macros += [("MMTF_MSGPACK_USE_CPP11", None)] + def_macros += [ + ("MMTF_MSGPACK_USE_CPP11", None), + ("MSGPACK_NO_BOOST", None), + ] else: libs += ['msgpackc'] diff --git a/testing/tests/api/externing.py b/testing/tests/api/externing.py index ac52bce31..b3ccdcb9d 100644 --- a/testing/tests/api/externing.py +++ b/testing/tests/api/externing.py @@ -1,4 +1,5 @@ import os +import sys from pymol import cmd, testing, stored def touch(filename): @@ -9,8 +10,17 @@ class TestExterning(testing.PyMOLTestCase): def testCdLsPwd(self): with testing.mkdtemp() as path: cmd.cd(path) - self.assertEqual(os.getcwd(), - os.path.realpath(path)) + if sys.platform == 'win32': + import ctypes + def get_long_path_name(path): + buf = ctypes.create_unicode_buffer(260) + ctypes.windll.kernel32.GetLongPathNameW(path, buf, len(buf)) + return buf.value + self.assertEqual(get_long_path_name(os.getcwd()), + get_long_path_name(os.path.realpath(path))) + else: + self.assertEqual(os.getcwd(), + os.path.realpath(path)) touch('foo1.txt') touch('foo2.txt') From 6d9ddd4bd3eaf31b96b33a557b6f7c101bb2cebe Mon Sep 17 00:00:00 2001 From: Jarrett Johnson Date: Sun, 12 May 2024 12:55:49 -0400 Subject: [PATCH 12/17] Add header for glm::translate --- layer1/SceneView.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/layer1/SceneView.cpp b/layer1/SceneView.cpp index e320246ba..c723d14a0 100644 --- a/layer1/SceneView.cpp +++ b/layer1/SceneView.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include "pymol/algorithm.h" From 3943835a93c039cb657ce4a63434e99a40358466 Mon Sep 17 00:00:00 2001 From: Jarrett Johnson <36459667+JarrettSJohnson@users.noreply.github.com> Date: Fri, 5 Apr 2024 15:48:22 -0400 Subject: [PATCH 13/17] PYMOL-4854: Add cell_color setting for unit cell coloring --- layer1/Setting.cpp | 3 +++ layer1/SettingInfo.h | 1 + layer2/CoordSet.cpp | 7 ++++++- layer2/ObjectSurface.cpp | 7 ++++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/layer1/Setting.cpp b/layer1/Setting.cpp index 6cafac36f..bd3382f32 100644 --- a/layer1/Setting.cpp +++ b/layer1/Setting.cpp @@ -2481,6 +2481,9 @@ void SettingGenerateSideEffects(PyMOLGlobals * G, int index, const char *sele, i ExecutiveInvalidateRep(G, inv_sele, cRepSphere, cRepInvRep); SceneInvalidate(G); break; + case cSetting_cell_color: + ExecutiveInvalidateRep(G, inv_sele, cRepCell, cRepInvColor); + SceneInvalidate(G); case cSetting_cull_spheres: case cSetting_sphere_scale: case cSetting_sphere_transparency: diff --git a/layer1/SettingInfo.h b/layer1/SettingInfo.h index 83f589250..a905aa3eb 100644 --- a/layer1/SettingInfo.h +++ b/layer1/SettingInfo.h @@ -904,6 +904,7 @@ enum { REC_f( 794, halogen_bond_as_acceptor_max_acceptor_angle , global , 170.0f ), REC_f( 795, salt_bridge_distance , global , 5.0f ), REC_b( 796, use_tessellation_shaders , global , true ), + REC_c( 797, cell_color , ostate , "-1" ), #ifdef SETTINGINFO_IMPLEMENTATION #undef SETTINGINFO_IMPLEMENTATION diff --git a/layer2/CoordSet.cpp b/layer2/CoordSet.cpp index cfa3a351c..7eab88129 100644 --- a/layer2/CoordSet.cpp +++ b/layer2/CoordSet.cpp @@ -1287,7 +1287,12 @@ void CoordSet::update(int state) UnitCellCGO.reset(CrystalGetUnitCellCGO(&sym->Crystal)); auto use_shader = SettingGet(G, cSetting_use_shaders); if (use_shader) { - auto color = ColorGet(G, Obj->Color); + auto cell_color = SettingGet_color( + G, this->Setting.get(), Obj->Setting.get(), cSetting_cell_color); + if (cell_color < 0) { + cell_color = Obj->Color; + } + auto color = ColorGet(G, cell_color); auto preCGO = std::make_unique(G); CGOColorv(preCGO.get(), color); CGOAppendNoStop(preCGO.get(), UnitCellCGO.get()); diff --git a/layer2/ObjectSurface.cpp b/layer2/ObjectSurface.cpp index 3a8e90762..5080ba886 100644 --- a/layer2/ObjectSurface.cpp +++ b/layer2/ObjectSurface.cpp @@ -870,7 +870,12 @@ static void ObjectSurfaceRenderCell(PyMOLGlobals *G, ObjectSurface * I, * TODO: Ray with primitive CGO */ - const float *color = ColorGet(G, I->Color); + // TODO: Surface-state level color? + auto cell_color = SettingGet_color(*I, cSetting_cell_color); + if (cell_color < 0) { + cell_color = I->Color; + } + const float *color = ColorGet(G, cell_color); if (use_shader != ms->UnitCellCGO->has_draw_buffers){ if (use_shader){ auto preCGO = std::make_unique(G); From 6a7e094a0d4c5dcf26261459ef0b63751ddde05e Mon Sep 17 00:00:00 2001 From: Pedro Lacerda Date: Mon, 20 May 2024 09:28:17 -0300 Subject: [PATCH 14/17] declare_command cmd extension API (#349) --- modules/pymol/cmd.py | 2 +- modules/pymol/commanding.py | 100 ++++++++++++++++++++++++++++++ testing/tests/api/commanding.py | 104 ++++++++++++++++++++++++++++++++ 3 files changed, 205 insertions(+), 1 deletion(-) diff --git a/modules/pymol/cmd.py b/modules/pymol/cmd.py index 6c89f72cd..09ae92f9e 100644 --- a/modules/pymol/cmd.py +++ b/modules/pymol/cmd.py @@ -202,7 +202,7 @@ def as_pathstr(path): # for extending the language - from .commanding import extend, extendaa, alias + from .commanding import declare_command, extend, extendaa, alias # for documentation etc diff --git a/modules/pymol/commanding.py b/modules/pymol/commanding.py index 4f52321fd..470994f33 100644 --- a/modules/pymol/commanding.py +++ b/modules/pymol/commanding.py @@ -20,6 +20,15 @@ import urllib.request as urllib2 from io import FileIO as file + import inspect + import glob + import shlex + from enum import Enum + from functools import wraps + from pathlib import Path + from textwrap import dedent + from typing import List + import re import os import time @@ -529,6 +538,97 @@ def delete(name, *, _self=cmd): if _self._raising(r,_self): raise pymol.CmdException return r + + class Selection(str): + pass + + + def _parse_bool(value: str): + if isinstance(value, str): + if value.lower() in ["yes", "1", "true", "on", "y"]: + return True + elif value.lower() in ["no", "0", "false", "off", "n"]: + return False + else: + raise Exception("Invalid boolean value: %s" % value) + elif isinstance(value, bool): + return value + else: + raise Exception(f"Unsuported boolean flag {value}") + + def _parse_list_str(value): + return shlex.split(value) + + def _parse_list_int(value): + return list(map(int, shlex.split(value))) + + def _parse_list_float(value): + return list(map(float, shlex.split(value))) + + def declare_command(name, function=None, _self=cmd): + if function is None: + name, function = name.__name__, name + + # new style commands should have annotations + annotations = [a for a in function.__annotations__ if a != "return"] + if function.__code__.co_argcount != len(annotations): + raise Exception("Messy annotations") + + # docstring text, if present, should be dedented + if function.__doc__ is not None: + function.__doc__ = dedent(function.__doc__).strip() + + + # Analysing arguments + spec = inspect.getfullargspec(function) + kwargs_ = {} + args_ = spec.args[:] + defaults = list(spec.defaults or []) + + args2_ = args_[:] + while args_ and defaults: + kwargs_[args_.pop(-1)] = defaults.pop(-1) + + funcs = {} + for idx, (var, func) in enumerate(spec.annotations.items()): + funcs[var] = func + + # Inner function that will be callable every time the command is executed + @wraps(function) + def inner(*args, **kwargs): + frame = traceback.format_stack()[-2] + caller = frame.split("\"", maxsplit=2)[1] + + # It was called from command line or pml script, so parse arguments + if caller.endswith("pymol/parser.py"): + kwargs = {**kwargs_, **kwargs, **dict(zip(args2_, args))} + kwargs.pop("_self", None) + for arg in kwargs.copy(): + if funcs[arg] == bool: + funcs[arg] = _parse_bool + elif funcs[arg] == List[str]: + funcs[arg] = _parse_list_str + elif funcs[arg] == List[int]: + funcs[arg] = _parse_list_int + elif funcs[arg] == List[float]: + funcs[arg] = _parse_list_float + else: + # Assume it's a literal supported type + pass + # Convert the argument to the correct type + kwargs[arg] = funcs[arg](kwargs[arg]) + return function(**kwargs) + + # It was called from Python, so pass the arguments as is + else: + return function(*args, **kwargs) + + name = function.__name__ + _self.keyword[name] = [inner, 0, 0, ",", parsing.STRICT] + _self.kwhash.append(name) + _self.help_sc.append(name) + return inner + def extend(name, function=None, _self=cmd): ''' diff --git a/testing/tests/api/commanding.py b/testing/tests/api/commanding.py index e09ec789e..e9d671224 100644 --- a/testing/tests/api/commanding.py +++ b/testing/tests/api/commanding.py @@ -1,10 +1,17 @@ from __future__ import print_function import sys +import pytest + import pymol import __main__ from pymol import cmd, testing, stored +from typing import List + + + + class TestCommanding(testing.PyMOLTestCase): def testAlias(self): @@ -171,3 +178,100 @@ def testRun(self, namespace, mod, rw): self.assertTrue(stored.tmp) if mod: self.assertEqual(rw, hasattr(sys.modules[mod], varname)) + +def test_declare_command_casting(): + from pathlib import Path + + @cmd.declare_command + def func(a: int, b: Path): + assert isinstance(a, int) and a == 1 + assert isinstance(b, (Path, str)) and "/tmp" == str(b) + func(1, "/tmp") + cmd.do('func 1, /tmp') + + +def test_declare_command_default(capsys): + from pymol.commanding import Selection + @cmd.declare_command + def func(a: Selection = "sele"): + assert a == "sele" + func() + cmd.do("func") + out, err = capsys.readouterr() + assert out == '' + +def test_declare_command_docstring(): + @cmd.declare_command + def func(): + """docstring""" + assert func.__doc__ == "docstring" + + @cmd.declare_command + def func(): + """ + docstring + Test: + --foo + """ + assert func.__doc__ == "docstring\nTest:\n --foo" + + +def test_declare_command_type_return(capsys): + @cmd.declare_command + def func() -> int: + return 1 + + assert func() == 1 + out, err = capsys.readouterr() + assert out == '' + + @cmd.declare_command + def func(): + return 1 + assert func() == 1 + +def test_declare_command_list_str(capsys): + @cmd.declare_command + def func(a: List[str]): + print(a[-1]) + + func(["a", "b", "c"]) + cmd.do('func a b c') + out, err = capsys.readouterr() + assert out == 'c\nc\n' + +def test_declare_command_list_int(capsys): + @cmd.declare_command + def func(a: List[int]): + print(a[-1] ** 2) + return a[-1] ** 2 + + assert func([1, 2, 3]) == 9 + cmd.do('func 1 2 3') + out, err = capsys.readouterr() + assert out == '9\n9\n' + + +def test_declare_command_list_float(capsys): + @cmd.declare_command + def func(a: List[float]): + print(a[-1]**2) + return a[-1]**2 + + assert func([1.1, 2.0, 3.0]) == 9.0 + cmd.do('func 1 2 3') + out, err = capsys.readouterr() + assert out == '9.0\n9.0\n' + + +def test_declare_command_bool(capsys): + @cmd.declare_command + def func(a: bool, b: bool): + assert a + assert not b + + func(True, False) + + cmd.do("func yes, no") + out, err = capsys.readouterr() + assert out == '' and err == '' \ No newline at end of file From 74ffc07ea75fe2237b278de095ba95cf843d08c6 Mon Sep 17 00:00:00 2001 From: Jarrett Johnson Date: Mon, 20 May 2024 08:37:07 -0400 Subject: [PATCH 15/17] Replace monkeypatch distutils with CMake setuptools Extensions --- CMakeLists.txt | 31 ++++++ INSTALL | 1 + contrib/champ/champ_module.c | 2 +- layer4/Cmd.cpp | 2 +- setup.py | 176 +++++++++++++++++++++++++++-------- 5 files changed, 173 insertions(+), 39 deletions(-) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..0620b6f5f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.13) + +project(${TARGET_NAME}) + +set(CMAKE_VERBOSE_MAKEFILE on) + +add_library(${TARGET_NAME} SHARED ${ALL_SRC}) + +target_compile_options(${TARGET_NAME} PRIVATE ${ALL_COMP_ARGS}) + +set_target_properties(${TARGET_NAME} PROPERTIES SUFFIX ${SHARED_SUFFIX}) + +target_compile_features(${TARGET_NAME} PRIVATE cxx_std_17) + +set_target_properties(${TARGET_NAME} PROPERTIES PREFIX "") + +target_include_directories(${TARGET_NAME} PUBLIC ${ALL_INC_DIR}) + +target_link_directories(${TARGET_NAME} PUBLIC ${ALL_LIB_DIR}) + + +if(APPLE) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -undefined dynamic_lookup") +endif() + +target_link_libraries(${TARGET_NAME} + ${ALL_LIB} + ${ALL_EXT_LINK} +) + +target_compile_definitions(${TARGET_NAME} PUBLIC ${ALL_DEF}) diff --git a/INSTALL b/INSTALL index 08a6776af..edfc56ad6 100644 --- a/INSTALL +++ b/INSTALL @@ -8,6 +8,7 @@ See also: http://pymolwiki.org/index.php/Linux_Install REQUIREMENTS - C++17 compiler (e.g. gcc 8+) + - CMake (3.13+) - Python 3.6+ - Pmw (Python Megawidgets) (optional, for legacy GUI/plugins) https://github.com/schrodinger/pmw-patched diff --git a/contrib/champ/champ_module.c b/contrib/champ/champ_module.c index 5b984b895..b8ed4aed0 100644 --- a/contrib/champ/champ_module.c +++ b/contrib/champ/champ_module.c @@ -1053,7 +1053,7 @@ static PyMethodDef champ_methods[] = { {NULL, NULL} /* sentinel */ }; -PyObject * PyInit__champ(void) +PyMODINIT_FUNC PyInit__champ(void) { static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, diff --git a/layer4/Cmd.cpp b/layer4/Cmd.cpp index 20b9ca263..d110a2ca9 100644 --- a/layer4/Cmd.cpp +++ b/layer4/Cmd.cpp @@ -6531,7 +6531,7 @@ static PyMethodDef Cmd_methods[] = { extern "C" { #endif -PyObject * PyInit__cmd(void) +PyMODINIT_FUNC PyInit__cmd(void) { static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, diff --git a/setup.py b/setup.py index eb18dd137..83111878b 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # -# This script only applies if you are performing a Python Distutils-based +# This script only applies if you are performing a Python setuptools-based # installation of PyMOL. # # It may assume that all of PyMOL's external dependencies are @@ -9,12 +9,16 @@ import argparse import glob import os +import pathlib import re import sys +import sysconfig import shutil -from distutils.core import setup, Extension -from distutils.util import change_root +from setuptools import setup, Extension +from setuptools.command.build_ext import build_ext +from setuptools.command.build_py import build_py +from setuptools.command.install import install import create_shadertext @@ -33,7 +37,6 @@ class options: no_libxml = False no_glut = True use_msgpackc = 'guess' - help_distutils = False testing = False openvr = False use_openmp = 'no' if MAC else 'yes' @@ -58,8 +61,6 @@ class options: parser.add_argument('--use-msgpackc', choices=('c++11', 'c', 'guess', 'no'), help="c++11: use msgpack-c header-only library; c: link against " "shared library; no: disable fast MMTF load support") -parser.add_argument('--help-distutils', action="store_true", - help="show help for distutils options and exit") parser.add_argument('--testing', action="store_true", help="Build C-level tests") parser.add_argument('--openvr', dest='openvr', action='store_true') @@ -68,10 +69,7 @@ class options: help='Disable VMD molfile plugins (libnetcdf dependency)') options, sys.argv[1:] = parser.parse_known_args(namespace=options) -if options.help_distutils: - sys.argv.append("--help") - -if True: +if False: import monkeypatch_distutils monkeypatch_distutils.set_parallel_jobs(options.jobs) @@ -137,16 +135,104 @@ def guess_msgpackc(): return 'no' -# Important: import 'distutils.command' modules after monkeypatch_distutils -from distutils.command.build_ext import build_ext -from distutils.command.build_py import build_py -from distutils.command.install import install +class CMakeExtension(Extension): + + def __init__(self, + name, + sources, + include_dirs=[], + libraries=[], + library_dirs=[], + define_macros=[], + extra_link_args=[], + extra_compile_args=[]): + # don't invoke the original build_ext for this special extension + super().__init__(name, sources=[]) + self.sources = sources + self.include_dirs = include_dirs + self.libraries = libraries + self.library_dirs = library_dirs + self.define_macros = define_macros + self.extra_link_args = extra_link_args + self.extra_compile_args = extra_compile_args + class build_ext_pymol(build_ext): - def initialize_options(self): - build_ext.initialize_options(self) + def initialize_options(self) -> None: + super().initialize_options() if DEBUG and not WIN: - self.debug = True + self.debug = False + + def run(self): + for ext in self.extensions: + self.build_cmake(ext) + + def build_cmake(self, ext): + cwd = pathlib.Path().absolute() + + # these dirs will be created in build_py, so if you don't have + # any python sources to bundle, the dirs will be missing + name_split = ext.name.split('.') + target_name = name_split[-1] + build_temp = pathlib.Path(self.build_temp) / target_name + build_temp.mkdir(parents=True, exist_ok=True) + extdir = pathlib.Path(self.get_ext_fullpath(ext.name)) + extdirabs = extdir.absolute() + + extdir.parent.mkdir(parents=True, exist_ok=True) + + def concat_paths(paths): + return ''.join(path.replace('\\', '/') + ";" for path in paths) + + config = 'Debug' if DEBUG else 'Release' + lib_output_dir = str(extdir.parent.absolute()) + all_files = ext.sources + all_src = concat_paths(all_files) + all_defs = ''.join(mac[0] + ";" for mac in ext.define_macros) + all_libs = ''.join(f"{lib};" for lib in ext.libraries) + all_ext_link = ' '.join(ext.extra_link_args) + all_comp_args = ''.join(f"{arg};" for arg in ext.extra_compile_args) + all_lib_dirs = concat_paths(ext.library_dirs) + all_inc_dirs = concat_paths(ext.include_dirs) + + lib_mode = "RUNTIME" if WIN else "LIBRARY" + + shared_suffix = sysconfig.get_config_var('EXT_SUFFIX') + + cmake_args = [ + f"-DTARGET_NAME={target_name}", + f"-DCMAKE_{lib_mode}_OUTPUT_DIRECTORY={lib_output_dir}", + f"-DCMAKE_BUILD_TYPE={config}", + f"-DALL_INC_DIR={all_inc_dirs}", + f"-DALL_SRC={all_src}", + f"-DALL_DEF={all_defs}", + f"-DALL_LIB_DIR={all_lib_dirs}", + f"-DALL_LIB={all_libs}", + f"-DALL_COMP_ARGS={all_comp_args}", + f"-DALL_EXT_LINK={all_ext_link}", + f"-DSHARED_SUFFIX={shared_suffix}" + ] + + # example of build args + build_args = ['--config', config] + if not WIN: # Win /MP flag on compilation level + cpu_count = os.cpu_count() or 1 + build_args += [f'-j{cpu_count}'] + + os.chdir(str(build_temp)) + self.spawn(['cmake', str(cwd)] + cmake_args) + if not self.dry_run: + self.spawn(['cmake', '--build', '.'] + build_args) + + if WIN: + # Move up from VS release folder + cmake_lib_loc = pathlib.Path(lib_output_dir, "Release", f"{target_name}{shared_suffix}") + if cmake_lib_loc.exists(): + shutil.move(cmake_lib_loc, extdirabs) + + # Troubleshooting: if fail on line above then delete all possible + # temporary CMake files including "CMakeCache.txt" in top level dir. + os.chdir(str(cwd)) class build_py_pymol(build_py): @@ -175,10 +261,11 @@ def finalize_options(self): self.pymol_path = os.path.join( self.install_libbase, 'pymol', 'pymol_path') elif self.root is not None: - self.pymol_path = change_root(self.root, self.pymol_path) + self.pymol_path = install_pymol.change_root( + self.root, self.pymol_path) def run(self): - install.run(self) + super().run() self.install_pymol_path() if not self.no_launcher: @@ -304,7 +391,7 @@ def make_launch_script(self): '-Wno-char-subscripts', # optimizations "-Og" if DEBUG else "-O3", -] if not WIN else [] +] if not WIN else ["/MP"] ext_link_args = [] ext_objects = [] data_files = [] @@ -382,9 +469,9 @@ def make_launch_script(self): if options.osx_frameworks: ext_link_args += [ - "-framework", "OpenGL", + "-framework OpenGL", ] + (not options.no_glut) * [ - "-framework", "GLUT", + "-framework GLUT", ] def_macros += [ ("_PYMOL_OSX", None), @@ -527,22 +614,37 @@ def get_packages(base, parent='', r=None): for base in ['modules'] for x in get_packages(base)) +# Python includes +inc_dirs.append(sysconfig.get_paths()['include']) +inc_dirs.append(sysconfig.get_paths()['platinclude']) + +champ_inc_dirs = ['contrib/champ'] +champ_inc_dirs.append(sysconfig.get_paths()['include']) +champ_inc_dirs.append(sysconfig.get_paths()['platinclude']) + +if WIN: + # pyconfig.py forces linking against pythonXY.lib on MSVC + py_lib = pathlib.Path(sysconfig.get_paths()['stdlib']).parent / 'libs' + lib_dirs.append(str(py_lib)) + ext_modules += [ - Extension("pymol._cmd", - get_sources(pymol_src_dirs), - include_dirs=inc_dirs, - libraries=libs, - library_dirs=lib_dirs, - define_macros=def_macros, - extra_link_args=ext_link_args, - extra_compile_args=ext_comp_args, - extra_objects=ext_objects, - ), - - Extension("chempy.champ._champ", - get_sources(['contrib/champ']), - include_dirs=["contrib/champ"], - ), + CMakeExtension( + name="pymol._cmd", + sources=get_sources(pymol_src_dirs), + include_dirs=inc_dirs, + libraries=libs, + library_dirs=lib_dirs, + define_macros=def_macros, + extra_link_args=ext_link_args, + extra_compile_args=ext_comp_args, + ), + + CMakeExtension( + name="chempy.champ._champ", + sources=get_sources(['contrib/champ']), + include_dirs=champ_inc_dirs, + library_dirs=lib_dirs, + ), ] distribution = setup( # Distribution meta-data From 716cc7a21a9f654eee1778cfaeed4c9e824aef3c Mon Sep 17 00:00:00 2001 From: Jarrett Johnson Date: Mon, 20 May 2024 08:58:40 -0400 Subject: [PATCH 16/17] Bump Python requirement to at least 3.9 --- INSTALL | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/INSTALL b/INSTALL index edfc56ad6..abe3c8b14 100644 --- a/INSTALL +++ b/INSTALL @@ -9,7 +9,7 @@ REQUIREMENTS - C++17 compiler (e.g. gcc 8+) - CMake (3.13+) - - Python 3.6+ + - Python 3.9+ - Pmw (Python Megawidgets) (optional, for legacy GUI/plugins) https://github.com/schrodinger/pmw-patched - OpenGL From fbfda4a2573d638049dbb51fb6d1e2ac59cd58c4 Mon Sep 17 00:00:00 2001 From: Jarrett Johnson Date: Mon, 20 May 2024 09:07:33 -0400 Subject: [PATCH 17/17] Replace NULL with nullptr --- layer0/Crystal.cpp | 6 +- layer0/Field.cpp | 10 +- layer0/File.cpp | 6 +- layer0/GraphicsUtil.cpp | 2 +- layer0/Isosurf.cpp | 42 +- layer0/ListMacros.h | 18 +- layer0/Map.cpp | 12 +- layer0/Match.cpp | 4 +- layer0/Matrix.cpp | 4 +- layer0/MemoryDebug.cpp | 12 +- layer0/MyPNG.cpp | 60 +-- layer0/Pixmap.cpp | 2 +- layer0/Result.h | 2 +- layer0/ShaderMgr.cpp | 6 +- layer0/Sphere.cpp | 4 +- layer0/Tetsurf.cpp | 20 +- layer0/Texture.cpp | 2 +- layer0/Tracker.cpp | 34 +- layer0/Triangle.cpp | 18 +- layer0/Word.cpp | 8 +- layer0/ccealignmodule.cpp | 4 +- layer0/vla.h | 6 +- layer1/Basis.cpp | 36 +- layer1/ButMode.cpp | 2 +- layer1/CGO.cpp | 124 +++--- layer1/CGO.h | 6 +- layer1/CGOGL.cpp | 50 +-- layer1/COLLADA.cpp | 22 +- layer1/Character.cpp | 4 +- layer1/Color.cpp | 16 +- layer1/Control.cpp | 2 +- layer1/Extrude.cpp | 66 +-- layer1/FontGLUT.cpp | 4 +- layer1/FontType.cpp | 8 +- layer1/Movie.cpp | 32 +- layer1/Ortho.cpp | 72 +-- layer1/P.cpp | 78 ++-- layer1/P.h | 2 +- layer1/PConv.cpp | 50 +-- layer1/PConv.h | 4 +- layer1/Picking.cpp | 2 +- layer1/Pop.cpp | 2 +- layer1/PyMOLObject.cpp | 52 +-- layer1/PyMOLObject.h | 2 +- layer1/Ray.cpp | 42 +- layer1/Rep.cpp | 2 +- layer1/Scene.cpp | 78 ++-- layer1/Scene.h | 2 +- layer1/SceneMouse.cpp | 76 ++-- layer1/ScenePicking.cpp | 12 +- layer1/SceneRay.cpp | 14 +- layer1/SceneRender.cpp | 30 +- layer1/Seq.cpp | 2 +- layer1/Setting.cpp | 62 +-- layer1/Setting.h | 2 +- layer1/Symmetry.cpp | 10 +- layer1/Text.cpp | 6 +- layer1/TypeFace.cpp | 2 +- layer1/View.cpp | 20 +- layer1/Wizard.cpp | 6 +- layer2/AtomInfo.cpp | 20 +- layer2/AtomInfoHistory.h | 4 +- layer2/CifBondDict.h | 2 +- layer2/CifFile.cpp | 8 +- layer2/CifFile.h | 14 +- layer2/CifMoleculeReader.cpp | 16 +- layer2/CoordSet.cpp | 40 +- layer2/DistSet.cpp | 12 +- layer2/GadgetSet.cpp | 36 +- layer2/MmtfMoleculeReader.cpp | 2 +- layer2/MolV3000.cpp | 2 +- layer2/ObjectAlignment.cpp | 44 +- layer2/ObjectCGO.cpp | 70 +-- layer2/ObjectCallback.cpp | 20 +- layer2/ObjectDist.cpp | 14 +- layer2/ObjectGadget.cpp | 26 +- layer2/ObjectGadgetRamp.cpp | 26 +- layer2/ObjectGroup.cpp | 8 +- layer2/ObjectMap.cpp | 70 +-- layer2/ObjectMesh.cpp | 90 ++-- layer2/ObjectMolecule.cpp | 266 +++++------ layer2/ObjectMolecule2.cpp | 94 ++-- layer2/ObjectSlice.cpp | 64 +-- layer2/ObjectSurface.cpp | 48 +- layer2/ObjectVolume.cpp | 46 +- layer2/RepAngle.cpp | 42 +- layer2/RepCartoon.cpp | 114 ++--- layer2/RepCylBond.cpp | 26 +- layer2/RepDihedral.cpp | 38 +- layer2/RepDistDash.cpp | 34 +- layer2/RepDistLabel.cpp | 46 +- layer2/RepDot.cpp | 12 +- layer2/RepEllipsoid.cpp | 16 +- layer2/RepLabel.cpp | 24 +- layer2/RepMesh.cpp | 66 +-- layer2/RepNonbonded.cpp | 14 +- layer2/RepNonbondedSphere.cpp | 14 +- layer2/RepRibbon.cpp | 34 +- layer2/RepSphere.cpp | 20 +- layer2/RepSphereGenerate.cpp | 2 +- layer2/RepSurface.cpp | 188 ++++---- layer2/RepWireBond.cpp | 18 +- layer2/Sculpt.cpp | 18 +- layer2/VFont.cpp | 14 +- layer3/Editor.cpp | 90 ++-- layer3/Executive.cpp | 686 ++++++++++++++-------------- layer3/Executive.h | 2 +- layer3/ExecutivePython.cpp | 12 +- layer3/Interactions.cpp | 2 +- layer3/MoleculeExporter.cpp | 6 +- layer3/MovieScene.cpp | 4 +- layer3/MovieScene.h | 2 +- layer3/PlugIOManager.cpp | 76 ++-- layer3/Seeker.cpp | 60 +-- layer3/Selector.cpp | 386 ++++++++-------- layer4/Cmd.cpp | 812 +++++++++++++++++----------------- layer4/Menu.cpp | 12 +- layer4/PopUp.cpp | 24 +- layer5/PyMOL.cpp | 38 +- layer5/TestPyMOL.cpp | 16 +- layer5/main.cpp | 10 +- layerCTest/Test_VLA.cpp | 8 +- 122 files changed, 2656 insertions(+), 2656 deletions(-) diff --git a/layer0/Crystal.cpp b/layer0/Crystal.cpp index 379169e0b..6a1d7897a 100644 --- a/layer0/Crystal.cpp +++ b/layer0/Crystal.cpp @@ -30,7 +30,7 @@ Z* ------------------------------------------------------------------- PyObject *CrystalAsPyList(const CCrystal * I) { - PyObject *result = NULL; + PyObject *result = nullptr; if(I) { result = PyList_New(2); @@ -45,7 +45,7 @@ int CrystalFromPyList(CCrystal * I, PyObject * list) int ok = true, rok = true; int ll = 0; if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -116,7 +116,7 @@ CGO *CrystalGetUnitCellCGO(const CCrystal * I) { PyMOLGlobals *G = I->G; float v[3]; - CGO *cgo = NULL; + CGO *cgo = nullptr; auto const ucv = SettingGet(G, cSetting_cell_centered) ? unitCellVerticesCentered diff --git a/layer0/Field.cpp b/layer0/Field.cpp index e27bedece..19ab14166 100644 --- a/layer0/Field.cpp +++ b/layer0/Field.cpp @@ -37,7 +37,7 @@ PyObject *FieldAsNumPyArray(CField * field, short copy) { #ifndef _PYMOL_NUMPY printf("No numpy support\n"); - return NULL; + return nullptr; #else PyObject *result; @@ -65,7 +65,7 @@ PyObject *FieldAsNumPyArray(CField * field, short copy) if(typenum == -1) { printf("error: no typenum for type %d and base_size %d\n", field->type, field->base_size); - return NULL; + return nullptr; } auto dims = pymol::malloc(field->n_dim()); @@ -82,13 +82,13 @@ PyObject *FieldAsNumPyArray(CField * field, short copy) return result; ok_except1: printf("FieldAsNumPyArray failed\n"); - return NULL; + return nullptr; #endif } PyObject *FieldAsPyList(PyMOLGlobals * G, CField * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int n_elem; int pse_export_version = SettingGetGlobal_f(G, cSetting_pse_export_version) * 1000; @@ -137,7 +137,7 @@ CField *FieldNewFromPyList(PyMOLGlobals * G, PyObject * list) auto I = new CField(); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) diff --git a/layer0/File.cpp b/layer0/File.cpp index 0fa40230e..8d8848d90 100644 --- a/layer0/File.cpp +++ b/layer0/File.cpp @@ -34,7 +34,7 @@ static long fgetsize(FILE *fp) { /** * Allocate memory and read the entire file from the given file pointer. - * The file size is stored into the size pointer if not NULL. + * The file size is stored into the size pointer if not nullptr. */ static char * fgetcontents(FILE *fp, long *size) { long filesize = fgetsize(fp); @@ -66,7 +66,7 @@ FILE * pymol_fopen(const char * filename, const char * mode) { if (!MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, filename, len_filename, wfilename.data(), wfilename.size())) - return NULL; + return nullptr; fp = _wfopen(wfilename.data(), wmode.data()); } @@ -77,7 +77,7 @@ FILE * pymol_fopen(const char * filename, const char * mode) { /** * Allocate memory and read the entire file for the given filename. - * The file size is stored into the size pointer if not NULL. + * The file size is stored into the size pointer if not nullptr. */ char * FileGetContents(const char *filename, long *size) { char *contents; diff --git a/layer0/GraphicsUtil.cpp b/layer0/GraphicsUtil.cpp index 62df61211..64e22d0de 100755 --- a/layer0/GraphicsUtil.cpp +++ b/layer0/GraphicsUtil.cpp @@ -29,7 +29,7 @@ bool glCheckOkay() { /** * GL debugging callback - enable with "pymol --gldebug" * - * glDebugMessageCallback(gl_debug_proc, NULL); + * glDebugMessageCallback(gl_debug_proc, nullptr); * glEnable(GL_DEBUG_OUTPUT); */ void GLAPIENTRY gl_debug_proc( diff --git a/layer0/Isosurf.cpp b/layer0/Isosurf.cpp index 887cf1f2b..33ed241c4 100644 --- a/layer0/Isosurf.cpp +++ b/layer0/Isosurf.cpp @@ -97,14 +97,14 @@ static void _IsosurfFree(CIsosurf * I) void IsosurfFree(PyMOLGlobals * G) { _IsosurfFree(G->Isosurf); - G->Isosurf = NULL; + G->Isosurf = nullptr; } /*===========================================================================*/ PyObject *IsosurfAsPyList(PyMOLGlobals * G, Isofield * field) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(4); @@ -139,9 +139,9 @@ Isofield *IsosurfNewFromPyList(PyMOLGlobals * G, PyObject * list) int dim4[4]; int a; - Isofield *result = NULL; + Isofield *result = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO ENABLE BACKWARDS COMPATIBILITY... @@ -395,10 +395,10 @@ static CIsosurf *IsosurfNew(PyMOLGlobals * G) int c; CIsosurf *I = pymol::calloc(1); I->G = G; - I->VertexCodes = NULL; - I->ActiveEdges = NULL; - I->Point = NULL; - I->Line = NULL; + I->VertexCodes = nullptr; + I->ActiveEdges = nullptr; + I->Point = nullptr; + I->Line = nullptr; I->Skip = 0; for(c = 0; c < 256; c++) I->Code[c] = -1; @@ -1040,13 +1040,13 @@ static int IsosurfGradients(PyMOLGlobals * G, CSetting * set1, CSetting * set2, CField *points = field->points.get(); /* flags marking excluded regions to avoid (currently wasteful) */ - int *flag = NULL; + int *flag = nullptr; /* variable length array for recording segment paths */ int *active_cell = VLAlloc(int, 1000); /* ordered list of coordinates for processing */ - int *order = NULL; + int *order = nullptr; int range_size; /* total points in region being drawn */ int range_dim[3]; /* dimension of drawn region */ @@ -1149,7 +1149,7 @@ static int IsosurfGradients(PyMOLGlobals * G, CSetting * set1, CSetting * set2, for(pass = 0; pass < 2; pass++) { /* one pass down the gradient, one up */ int have_prev = false; /* flag & storage for previous gradient & locus */ - int *prev_locus = NULL; + int *prev_locus = nullptr; int locus[3]; /* what cell are we in? */ float fract[3] = { 0.0F, 0.0F, 0.0F }; /* where in the cell are we? */ @@ -1214,7 +1214,7 @@ static int IsosurfGradients(PyMOLGlobals * G, CSetting * set1, CSetting * set2, if((!have_prev) || (have_prev && ((locus[0] != prev_locus[0]) || (locus[1] != prev_locus[1]) || (locus[2] != prev_locus[2])))) { - /* above: prev_locus may be NULL, so relying upon shortcut logic eval */ + /* above: prev_locus may be nullptr, so relying upon shortcut logic eval */ /* stop if we hit a flagged cell (flag always in lower corner) */ @@ -1674,7 +1674,7 @@ static int IsosurfDrawLines(CIsosurf * II) #ifdef Trace LCount++; #endif - Cur = NULL; + Cur = nullptr; if(I->NLine != (*I->Num)[I->NSeg]) { /* any new lines? */ I->Num->check(I->NSeg + 1); (*I->Num)[I->NSeg] = I->NLine - (*I->Num)[I->NSeg]; @@ -1736,8 +1736,8 @@ static int IsosurfFindLines(CIsosurf * II) printf("IsosurfFindLines: bad index: %i \n", index); #endif while(cod > 0) { - p1 = NULL; - p2 = NULL; + p1 = nullptr; + p2 = nullptr; switch (cod) { case 40: case 32: @@ -1773,8 +1773,8 @@ static int IsosurfFindLines(CIsosurf * II) break; default: cod = 0; - p1 = NULL; - p2 = NULL; + p1 = nullptr; + p2 = nullptr; break; } if(p1 && p2) { @@ -1836,8 +1836,8 @@ static int IsosurfFindLines(CIsosurf * II) break; default: cod = 0; - p1 = NULL; - p2 = NULL; + p1 = nullptr; + p2 = nullptr; break; } if(p1 && p2) { @@ -1899,8 +1899,8 @@ static int IsosurfFindLines(CIsosurf * II) break; default: cod = 0; - p1 = NULL; - p2 = NULL; + p1 = nullptr; + p2 = nullptr; break; } if(p1 && p2) { diff --git a/layer0/ListMacros.h b/layer0/ListMacros.h index 4179bdf5b..73a0a6368 100644 --- a/layer0/ListMacros.h +++ b/layer0/ListMacros.h @@ -25,12 +25,12 @@ Z* ------------------------------------------------------------------- #include"Err.h" #include"Result.h" -#define ListInit(List) List = NULL +#define ListInit(List) List = nullptr #define ListAppend(List,Elem,Link,ElemType) \ { \ ElemType *current = (List); \ - ElemType *previous = NULL; \ + ElemType *previous = nullptr; \ while(current) \ { \ previous = current; \ @@ -40,7 +40,7 @@ Z* ------------------------------------------------------------------- previous->Link = Elem; \ else \ (List) = Elem; \ - (Elem)->Link = NULL; \ + (Elem)->Link = nullptr; \ } /** @@ -69,7 +69,7 @@ void ListAppendT(ElemType*& list, ElemType* ele){ #define ListFree(List,Link,ElemType) \ { \ ElemType *current = List; \ - ElemType *previous = NULL; \ + ElemType *previous = nullptr; \ while(current) \ { \ if(previous) \ @@ -79,13 +79,13 @@ void ListAppendT(ElemType*& list, ElemType* ele){ } \ if(previous) \ mfree(previous); \ - (List) = NULL; \ + (List) = nullptr; \ } #define ListDetach(List,Elem,Link,ElemType) \ { \ ElemType *current = List; \ - ElemType *previous = NULL; \ + ElemType *previous = nullptr; \ while(current) \ { \ if(current == (Elem)) \ @@ -99,7 +99,7 @@ void ListAppendT(ElemType*& list, ElemType* ele){ previous->Link = current->Link; \ else \ (List) = current->Link; \ - (Elem)->Link = NULL; \ + (Elem)->Link = nullptr; \ } \ } @@ -143,7 +143,7 @@ ElemType* ListDetachT(ElemType*& list, ElemType* ele){ } #define ListIterate(List,Counter,Link) \ - ( (Counter) = ((List) ? (((Counter) ? (Counter)->Link : (List))) : NULL)) + ( (Counter) = ((List) ? (((Counter) ? (Counter)->Link : (List))) : nullptr)) /* Elem handling routines */ @@ -166,7 +166,7 @@ ElemType* ListDetachT(ElemType*& list, ElemType* ele){ } \ } -#define ListElemFree(Elem) { mfree(Elem); Elem = NULL; } +#define ListElemFree(Elem) { mfree(Elem); Elem = nullptr; } /** * Retrives position of element in list diff --git a/layer0/Map.cpp b/layer0/Map.cpp index e8aac4058..bc8bd37ad 100644 --- a/layer0/Map.cpp +++ b/layer0/Map.cpp @@ -519,7 +519,7 @@ int MapSetupExpress(MapType * I) int *link = I->Link; int st, flag; int *i_ptr3, *i_ptr4, *i_ptr5; - int *e_list = NULL; + int *e_list = nullptr; int mx0 = I->iMax[0], mx1 = I->iMax[1], a, am1, ap2, *i_ptr1, b, bm1, bp2, *i_ptr2; unsigned int mapSize; int ok = true; @@ -744,13 +744,13 @@ float MapGetSeparation(PyMOLGlobals * G, float range, const float *mx, const flo MapType *MapNew(PyMOLGlobals * G, float range, const float *vert, int nVert, const float *extent) { - return (_MapNew(G, range, vert, nVert, extent, NULL, -1, 0)); + return (_MapNew(G, range, vert, nVert, extent, nullptr, -1, 0)); } MapType *MapNewCached(PyMOLGlobals * G, float range, const float *vert, int nVert, const float *extent, int group_id, int block_id) { - return (_MapNew(G, range, vert, nVert, extent, NULL, group_id, block_id)); + return (_MapNew(G, range, vert, nVert, extent, nullptr, group_id, block_id)); } MapType *MapNewFlagged(PyMOLGlobals * G, float range, const float *vert, int nVert, @@ -776,7 +776,7 @@ static MapType *_MapNew(PyMOLGlobals * G, float range, const float *vert, int nV " MapNew-Debug: entered.\n" ENDFD; CHECKOK(ok, I); if (!ok){ - return NULL; + return nullptr; } /* Initialize */ I->G = G; @@ -788,7 +788,7 @@ static MapType *_MapNew(PyMOLGlobals * G, float range, const float *vert, int nV CHECKOK(ok, I->Link); if (!ok){ MapFree(I); - return NULL; + return nullptr; } for(a = 0; a < nVert; a++) I->Link[a] = -1; @@ -932,7 +932,7 @@ static MapType *_MapNew(PyMOLGlobals * G, float range, const float *vert, int nV CHECKOK(ok, I->Head); if (!ok){ MapFree(I); - return NULL; + return nullptr; } /* initialize */ /* for(a=0;aDim[0];a++) diff --git a/layer0/Match.cpp b/layer0/Match.cpp index c9f62aaf5..d2f6f6655 100644 --- a/layer0/Match.cpp +++ b/layer0/Match.cpp @@ -88,7 +88,7 @@ CMatch *MatchNew(PyMOLGlobals * G, unsigned int na, unsigned int nb, int dist_ma if(!(I->mat && I->smat && ((!dist_mats) || (I->da && I->db)))) { MatchFree(I); - I = NULL; + I = nullptr; } return (I); } @@ -270,7 +270,7 @@ int MatchMatrixFromFile(CMatch * I, const char *fname, int quiet) std::string buffer; const char *p; char cc[255]; - char *code = NULL; + char *code = nullptr; unsigned int x, y; int a; int n_entry; diff --git a/layer0/Matrix.cpp b/layer0/Matrix.cpp index 7c84a9441..488754036 100644 --- a/layer0/Matrix.cpp +++ b/layer0/Matrix.cpp @@ -48,7 +48,7 @@ Z* ------------------------------------------------------------------- #define XX_FALSE 0 #endif #ifndef XX_NULL -#define XX_NULL NULL +#define XX_NULL nullptr #endif #define XX_MATRIX_STACK_STORAGE_MAX 5 @@ -1340,7 +1340,7 @@ float MatrixFitRMSTTTf(PyMOLGlobals * G, int n, const float *v1, const float *v2 /*========================================================================*/ /** - * @param G Only used for feedback, can be NULL + * @param G Only used for feedback, can be nullptr * @param[in] a 3x3 matrix * @param[out] wr 3x1 eigenvalues (real part of complex number) * @param[out] wi 3x1 eigenvalues (imag part of complex number) diff --git a/layer0/MemoryDebug.cpp b/layer0/MemoryDebug.cpp index 460c62854..b7252cd7e 100644 --- a/layer0/MemoryDebug.cpp +++ b/layer0/MemoryDebug.cpp @@ -80,7 +80,7 @@ void MemoryZero(char *p, char *q) * Update `size` and reallocate this vla * * @param size number of elements - * @return reallocated pointer or NULL if realloc failed + * @return reallocated pointer or nullptr if realloc failed */ static VLARec* VLARec_resize(VLARec* vla, ov_size size) { @@ -153,7 +153,7 @@ void VLAFree(void *ptr) { VLARec *vla; if(!ptr) { - printf("VLAFree-ERR: tried to free NULL pointer!\n"); + printf("VLAFree-ERR: tried to free nullptr pointer!\n"); exit(EXIT_FAILURE); } vla = &(((VLARec *) ptr)[-1]); @@ -169,7 +169,7 @@ size_t VLAGetSize(const void *ptr) void *VLANewCopy(const void *ptr) { - if(ptr) { /* NULL protected */ + if(ptr) { /* nullptr protected */ const VLARec *vla; VLARec *new_vla; vla = &((VLARec *) ptr)[-1]; @@ -183,14 +183,14 @@ void *VLANewCopy(const void *ptr) } return ((void *) &(new_vla[1])); } else { - return NULL; + return nullptr; } } void *VLASetSize(void *ptr, size_t new_size) { VLARec *vla; - char *start = NULL; + char *start = nullptr; char *stop; size_t soffset = 0; vla = &((VLARec *) ptr)[-1]; @@ -283,7 +283,7 @@ void *VLAInsertRaw(void *ptr, int index, unsigned int count) void *VLASetSizeForSure(void *ptr, size_t new_size) { VLARec *vla; - char *start = NULL; + char *start = nullptr; char *stop; size_t soffset = 0; vla = &((VLARec *) ptr)[-1]; diff --git a/layer0/MyPNG.cpp b/layer0/MyPNG.cpp index 1707f3e22..94a4c276d 100644 --- a/layer0/MyPNG.cpp +++ b/layer0/MyPNG.cpp @@ -77,7 +77,7 @@ static unsigned char base64_decoding_table[] = { static unsigned char *base64_decode(const char *data, size_t input_length=0) { - unsigned char *decoded_data = NULL; + unsigned char *decoded_data = nullptr; unsigned int triple; unsigned int i = 0, j = 0, k; char c; @@ -107,7 +107,7 @@ static unsigned char *base64_decode(const char *data, ok_except1: mfree(decoded_data); - return NULL; + return nullptr; } typedef struct { @@ -182,7 +182,7 @@ int MyPNGWrite(pymol::zstring_view file_name_view, const pymol::Image& img, { #ifdef _PYMOL_LIBPNG int ok = true; - FILE *fp = NULL; + FILE *fp = nullptr; png_structp png_ptr; png_infop info_ptr; int bit_depth = 8; @@ -204,7 +204,7 @@ int MyPNGWrite(pymol::zstring_view file_name_view, const pymol::Image& img, } else { fp = pymol_fopen(file_name, "wb"); } - if(fp == NULL) { + if(fp == nullptr) { ok = false; goto cleanup; } else if(feof(fp)) { @@ -214,21 +214,21 @@ int MyPNGWrite(pymol::zstring_view file_name_view, const pymol::Image& img, } /* Create and initialize the png_struct with the desired error handler * functions. If you want to use the default stderr and longjump method, - * you can supply NULL for the last three parameters. We also check that + * you can supply nullptr for the last three parameters. We also check that * the library version is compatible with the one used at compile time, * in case we are using dynamically linked libraries. REQUIRED. */ - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); - if(png_ptr == NULL) { + if(png_ptr == nullptr) { ok = false; goto cleanup; } /* Allocate/initialize the image information data. REQUIRED */ info_ptr = png_create_info_struct(png_ptr); - if(info_ptr == NULL) { - png_destroy_write_struct(&png_ptr, (png_infopp) NULL); + if(info_ptr == nullptr) { + png_destroy_write_struct(&png_ptr, (png_infopp) nullptr); ok = false; goto cleanup; } @@ -238,16 +238,16 @@ int MyPNGWrite(pymol::zstring_view file_name_view, const pymol::Image& img, */ if(setjmp(png_jmpbuf(png_ptr))) { /* If we get here, we had a problem reading the file */ - png_destroy_write_struct(&png_ptr, (png_infopp) NULL); + png_destroy_write_struct(&png_ptr, (png_infopp) nullptr); ok = false; goto cleanup; } if (io_ptr) { - png_set_write_fn(png_ptr, (void*) io_ptr, write_data_to_buffer, NULL); + png_set_write_fn(png_ptr, (void*) io_ptr, write_data_to_buffer, nullptr); } else { /* set up the output control if you are using standard C streams */ - png_set_write_fn(png_ptr, (void*) fp, write_data_to_file, NULL); + png_set_write_fn(png_ptr, (void*) fp, write_data_to_file, nullptr); } /* Set the image information here. Width and height are up to 2^31, @@ -366,13 +366,13 @@ std::unique_ptr MyPNGRead(const char *file_name) std::unique_ptr img; #ifdef _PYMOL_LIBPNG - FILE *png_file = NULL; - png_struct *png_ptr = NULL; - png_info *info_ptr = NULL; + FILE *png_file = nullptr; + png_struct *png_ptr = nullptr; + png_info *info_ptr = nullptr; png_byte buf[8]; - png_byte *png_pixels = NULL; - png_byte **row_pointers = NULL; - png_byte *pix_ptr = NULL; + png_byte *png_pixels = nullptr; + png_byte **row_pointers = nullptr; + png_byte *pix_ptr = nullptr; png_uint_32 row_bytes = 0; png_uint_32 width; @@ -384,7 +384,7 @@ std::unique_ptr MyPNGRead(const char *file_name) int i; int ok = true; double file_gamma; - uchar2p data = {NULL, NULL}; + uchar2p data = {NULL, nullptr}; if(!file_name) return nullptr; @@ -397,7 +397,7 @@ std::unique_ptr MyPNGRead(const char *file_name) } else { png_file = pymol_fopen(file_name, "rb"); - if(png_file == NULL) + if(png_file == nullptr) return nullptr; /* read and check signature in PNG file */ @@ -413,7 +413,7 @@ std::unique_ptr MyPNGRead(const char *file_name) } /* create png and info structures */ if(ok) { - png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr); if(!png_ptr) ok = false; } @@ -443,7 +443,7 @@ std::unique_ptr MyPNGRead(const char *file_name) /* get size and bit-depth of the PNG-image */ png_get_IHDR(png_ptr, info_ptr, - &width, &height, &bit_depth, &color_type, NULL, NULL, NULL); + &width, &height, &bit_depth, &color_type, nullptr, nullptr, nullptr); /* set-up the transformations */ @@ -465,21 +465,21 @@ std::unique_ptr MyPNGRead(const char *file_name) /* get the new color-type and bit-depth (after expansion/stripping) */ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, - NULL, NULL, NULL); + nullptr, nullptr, nullptr); /* row_bytes is the width x number of channels x (bit-depth / 8) */ row_bytes = png_get_rowbytes(png_ptr, info_ptr); - if((png_pixels = (png_byte *) malloc(row_bytes * height * sizeof(png_byte))) == NULL) { + if((png_pixels = (png_byte *) malloc(row_bytes * height * sizeof(png_byte))) == nullptr) { ok = false; } } if(ok) { - if((row_pointers = (png_byte **) malloc(height * sizeof(png_bytep))) == NULL) { - png_destroy_read_struct(&png_ptr, &info_ptr, NULL); + if((row_pointers = (png_byte **) malloc(height * sizeof(png_bytep))) == nullptr) { + png_destroy_read_struct(&png_ptr, &info_ptr, nullptr); free(png_pixels); - png_pixels = NULL; + png_pixels = nullptr; ok = false; } } @@ -512,13 +512,13 @@ std::unique_ptr MyPNGRead(const char *file_name) } - if(row_pointers != (unsigned char **) NULL) + if(row_pointers != (unsigned char **) nullptr) free(row_pointers); - if(png_pixels != (unsigned char *) NULL) + if(png_pixels != (unsigned char *) nullptr) free(png_pixels); if(png_ptr) { - png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL); + png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) nullptr); } if(png_file) fclose(png_file); diff --git a/layer0/Pixmap.cpp b/layer0/Pixmap.cpp index b4762aaa4..87016e522 100644 --- a/layer0/Pixmap.cpp +++ b/layer0/Pixmap.cpp @@ -122,7 +122,7 @@ void PixmapInitFromBytemap(PyMOLGlobals * G, CPixmap * I, unsigned char red, blue, green, alpha, no_alpha; unsigned char ored = 0, oblue = 0, ogreen = 0; if(!outline_rgb[3]) - outline_rgb = NULL; + outline_rgb = nullptr; else { ored = outline_rgb[0]; ogreen = outline_rgb[1]; diff --git a/layer0/Result.h b/layer0/Result.h index 973ab9f89..86024162f 100644 --- a/layer0/Result.h +++ b/layer0/Result.h @@ -149,7 +149,7 @@ template class Result const ResultT& result() const { return m_result; } /** - * Pointer to the expected object. Never NULL. Call is invalid if this + * Pointer to the expected object. Never nullptr. Call is invalid if this * instance is in error state. */ ResultT* operator->() diff --git a/layer0/ShaderMgr.cpp b/layer0/ShaderMgr.cpp index 726599872..8e587e738 100644 --- a/layer0/ShaderMgr.cpp +++ b/layer0/ShaderMgr.cpp @@ -292,7 +292,7 @@ static void disableShaders(PyMOLGlobals * G); #ifdef WIN32 /* REMOVE US */ PFNGLTEXIMAGE3DPROC getTexImage3D(){ - static PFNGLTEXIMAGE3DPROC my_glTexImage3D = NULL; + static PFNGLTEXIMAGE3DPROC my_glTexImage3D = nullptr; if (!my_glTexImage3D) my_glTexImage3D = (PFNGLTEXIMAGE3DPROC) wglGetProcAddress("glTexImage3D"); return my_glTexImage3D; @@ -432,10 +432,10 @@ static bool shader_cache_initialized = false; // filename -> contents (static filesystem) static std::map shader_cache_raw; -// preproc variable -> NULL terminated list of filenames ("used by") +// preproc variable -> nullptr terminated list of filenames ("used by") std::map ifdef_deps; -// filename -> NULL terminated list of filenames ("included by") +// filename -> nullptr terminated list of filenames ("included by") std::map include_deps; std::string CShaderMgr::GetShaderSource(const std::string &filename) diff --git a/layer0/Sphere.cpp b/layer0/Sphere.cpp index e8a3a6061..a40a5dfee 100644 --- a/layer0/Sphere.cpp +++ b/layer0/Sphere.cpp @@ -282,7 +282,7 @@ void SphereInit(PyMOLGlobals * G) I->Array[i].NTri = Sphere_NTri[i]; if (i){ - I->Array[i].Mesh = NULL; + I->Array[i].Mesh = nullptr; I->Array[i].NMesh = 0; } else { I->Array[i].Mesh = (int *) (void *) mesh; @@ -641,7 +641,7 @@ static SphereRec *MakeDotSphere(PyMOLGlobals * G, int level) result->nDot = S->NDot; result->NStrip = nStrip; result->NVertTot = nVertTot; - result->Mesh = NULL; + result->Mesh = nullptr; result->NMesh = 0; if(!level) { /* provide mesh for S->Sphere[0] only...rest, to do. */ result->Mesh = (int *) mesh; diff --git a/layer0/Tetsurf.cpp b/layer0/Tetsurf.cpp index 66e9a682f..0d78b535e 100644 --- a/layer0/Tetsurf.cpp +++ b/layer0/Tetsurf.cpp @@ -304,12 +304,12 @@ static CTetsurf *TetsurfNew(PyMOLGlobals * G) int v000, v100, v010, v110, v001, v101, v011, v111; I->G = G; - I->Tri = NULL; - I->PtLink = NULL; + I->Tri = nullptr; + I->PtLink = nullptr; - I->VertexCodes = NULL; - I->ActiveEdges = NULL; - I->Point = NULL; + I->VertexCodes = nullptr; + I->ActiveEdges = nullptr; + I->Point = nullptr; last_nv = nv; @@ -390,7 +390,7 @@ static void _TetsurfFree(CTetsurf * I) void TetsurfFree(PyMOLGlobals * G) { _TetsurfFree(G->Tetsurf); - G->Tetsurf = NULL; + G->Tetsurf = nullptr; } @@ -519,7 +519,7 @@ void TetsurfGetRange(PyMOLGlobals * G, * triangle strip with a single triangle) * @param[out] vert Normals (triangle modes only) and vertices for * strips according to `num` - * @param[in] range Min and max indices of box (6i - can be NULL, + * @param[in] range Min and max indices of box (6i - can be nullptr, * then use entire field) * @param[in] mode Geometry mode (points, lines, triangles) * @param[in] carvehelper For carving (optional) @@ -766,8 +766,8 @@ static int TetsurfFindActiveBoxes(CTetsurf * II, cIsosurfaceMode mode, int &n_st int i000, i001, i010, i011, i100, i101, i110, i111; float *c000, *c001, *c010, *c011, *c100, *c101, *c110, *c111; float d000, d001, d010, d011, d100, d101, d110, d111; - float *g000 = NULL, *g001 = NULL, *g010 = NULL, *g011 = NULL, *g100 = NULL, *g101 = - NULL, *g110 = NULL, *g111 = NULL; + float *g000 = nullptr, *g001 = nullptr, *g010 = nullptr, *g011 = nullptr, *g100 = nullptr, *g101 = + nullptr, *g110 = nullptr, *g111 = nullptr; int active; int n_active = 0; @@ -1376,7 +1376,7 @@ static int TetsurfFindActiveBoxes(CTetsurf * II, cIsosurfaceMode mode, int &n_st tt->done = true; while(1) { - p2 = NULL; + p2 = nullptr; idx = p1->Link; while(idx > 0) { tt = I->Tri + I->PtLink[idx].tri; diff --git a/layer0/Texture.cpp b/layer0/Texture.cpp index 02868bcd1..69b4f6d9a 100644 --- a/layer0/Texture.cpp +++ b/layer0/Texture.cpp @@ -140,7 +140,7 @@ bool TextureIsCharTextured(PyMOLGlobals* G, int char_id, float* extent) } } { - unsigned char *buffer = NULL; + unsigned char *buffer = nullptr; if (!I->texture) { is_new = true; } diff --git a/layer0/Tracker.cpp b/layer0/Tracker.cpp index 0536826d9..33cc838da 100644 --- a/layer0/Tracker.cpp +++ b/layer0/Tracker.cpp @@ -235,7 +235,7 @@ int TrackerNewListCopy(CTracker * I, int list_id, TrackerRef * ref) int iter_id = TrackerNewIter(I, 0, list_id); if(iter_id) { int cand_id; - while((cand_id = TrackerIterNextCandInList(I, iter_id, NULL))) { + while((cand_id = TrackerIterNextCandInList(I, iter_id, nullptr))) { TrackerLink(I, cand_id, new_list_id, 1); } TrackerDelIter(I, iter_id); @@ -806,7 +806,7 @@ int TrackerUnlink(CTracker * I, int cand_id, int list_id) int already_linked = false; auto hashStartIt = I->hash2member.find(hash_key); auto I_member = I->member.data(); - TrackerMember *member = NULL; + TrackerMember *member = nullptr; ov_word member_index{}; { @@ -930,14 +930,14 @@ int TrackerUnitTest(PyMOLGlobals * G) /* first test simple new/del */ for(a = 0; a < N_ID; a++) { - cand_id[a] = TrackerNewCand(I, NULL); + cand_id[a] = TrackerNewCand(I, nullptr); if(!cand_id[a]) fprintf(stderr, "TRACKER_UNIT_TEST FAILED AT LINE %d; %d==0\n", __LINE__, cand_id[a]); } for(a = 0; a < N_ID; a++) { - list_id[a] = TrackerNewList(I, NULL); + list_id[a] = TrackerNewList(I, nullptr); if(!list_id[a]) fprintf(stderr, "TRACKER_UNIT_TEST FAILED AT LINE %d; %d==0\n", __LINE__, list_id[a]); @@ -967,8 +967,8 @@ int TrackerUnitTest(PyMOLGlobals * G) } for(a = 0; a < N_ID; a++) { - cand_id[a] = TrackerNewCand(I, NULL); - list_id[a] = TrackerNewList(I, NULL); + cand_id[a] = TrackerNewCand(I, nullptr); + list_id[a] = TrackerNewList(I, nullptr); } /* test simple serial linking and unlinking */ @@ -1116,10 +1116,10 @@ int TrackerUnitTest(PyMOLGlobals * G) list_idx = (int) (N_ID * dist(mt)); if(!cand_id[cand_idx]) { - cand_id[cand_idx] = TrackerNewCand(I, NULL); + cand_id[cand_idx] = TrackerNewCand(I, nullptr); } if(!list_id[list_idx]) { - list_id[list_idx] = TrackerNewList(I, NULL); + list_id[list_idx] = TrackerNewList(I, nullptr); } if(cand_id[cand_idx] && list_id[list_idx]) { @@ -1203,8 +1203,8 @@ int TrackerUnitTest(PyMOLGlobals * G) /* okay, now let's mix in some iterators... */ for(a = 0; a < N_ID; a++) { - cand_id[a] = TrackerNewCand(I, NULL); - list_id[a] = TrackerNewList(I, NULL); + cand_id[a] = TrackerNewCand(I, nullptr); + list_id[a] = TrackerNewList(I, nullptr); } if(TrackerGetNCand(I) != N_ID) { @@ -1249,7 +1249,7 @@ int TrackerUnitTest(PyMOLGlobals * G) } len = 0; - while(TrackerIterNextListInCand(I, iter_id[a], NULL)) + while(TrackerIterNextListInCand(I, iter_id[a], nullptr)) len++; if(len != TrackerGetNListForCand(I, cand_id[cand_idx])) @@ -1271,7 +1271,7 @@ int TrackerUnitTest(PyMOLGlobals * G) } len = 0; - while(TrackerIterNextCandInList(I, iter_id[a], NULL)) + while(TrackerIterNextCandInList(I, iter_id[a], nullptr)) len++; if(len != TrackerGetNCandForList(I, list_id[list_idx])) @@ -1324,7 +1324,7 @@ int TrackerUnitTest(PyMOLGlobals * G) } for(b = 0; b < N_ID; b++) { - if(TrackerIterNextListInCand(I, iter_id[b], NULL)) + if(TrackerIterNextListInCand(I, iter_id[b], nullptr)) cnt++; } } @@ -1357,9 +1357,9 @@ int TrackerUnitTest(PyMOLGlobals * G) for(a = 0; a < N_ID; a++) { if(!cand_id[a]) - cand_id[a] = TrackerNewCand(I, NULL); + cand_id[a] = TrackerNewCand(I, nullptr); if(!list_id[a]) - list_id[a] = TrackerNewList(I, NULL); + list_id[a] = TrackerNewList(I, nullptr); } { @@ -1390,7 +1390,7 @@ int TrackerUnitTest(PyMOLGlobals * G) fprintf(stderr, "TRACKER_UNIT_TEST FAILED AT LINE %d; 0==%d\n", __LINE__, iter_id[a]); } - TrackerIterNextListInCand(I, iter_id[a], NULL); + TrackerIterNextListInCand(I, iter_id[a], nullptr); } for(a = 0; a < N_ID; a++) { @@ -1403,7 +1403,7 @@ int TrackerUnitTest(PyMOLGlobals * G) for(a = 0; a < N_ID; a++) { len = 1; - while(TrackerIterNextListInCand(I, iter_id[a], NULL)) + while(TrackerIterNextListInCand(I, iter_id[a], nullptr)) len++; diff = abs(len - TrackerGetNListForCand(I, iter_start[a])); diff --git a/layer0/Triangle.cpp b/layer0/Triangle.cpp index 6038c9d88..0d7445a62 100644 --- a/layer0/Triangle.cpp +++ b/layer0/Triangle.cpp @@ -313,8 +313,8 @@ static int TriangleAdjustNormals(TriangleSurfaceRec * II, float *v, float *vn, i TriangleSurfaceRec *I = II; int ok = true; /* points all normals to the average of the intersecting triangles in order to maximum surface smoothness */ - float *tNorm = NULL, *tWght; - int *vFlag = NULL; + float *tNorm = nullptr, *tWght; + int *vFlag = nullptr; float *v0, *v1, *v2, *tn, vt1[3], vt2[3], *vn0, *tn0, *tn1, *tn2, *tw; int a, *t, i0, i1, i2; float tmp[3]; @@ -2011,8 +2011,8 @@ static int TriangleFixProblems(TriangleSurfaceRec * II, float *v, float *vn, int int problemFlag; int a, l, e; int i0, i1, i2, s01 = 0, s02 = 0, s12; - int *pFlag = NULL; - int *vFlag = NULL; + int *pFlag = nullptr; + int *vFlag = nullptr; problemFlag = false; pFlag = pymol::malloc(n); @@ -2150,10 +2150,10 @@ static int TriangleBruteForceClosure(TriangleSurfaceRec * II, float *v, float *v int a, b, c, d; int i0, i1, i2; float *v1, *v2, *v0, vt1[3], vt2[3], vt3[3], vt4[3], *n0, *n1, *n2, tNorm[3]; - int *pFlag = NULL; - int *pair = NULL; + int *pFlag = nullptr; + int *pair = nullptr; int pc; - int *active = NULL; + int *active = nullptr; int ac; int hits; int p1, p2; @@ -2281,9 +2281,9 @@ int *TrianglePointsToSurface(PyMOLGlobals * G, float *v, float *vn, int n, float cutoff, int *nTriPtr, int **stripPtr, float *extent, int cavity_mode) { - TriangleSurfaceRec *I = NULL; + TriangleSurfaceRec *I = nullptr; int ok = true; - int *result = NULL; + int *result = nullptr; MapType *map; int a; diff --git a/layer0/Word.cpp b/layer0/Word.cpp index af4444593..5f7ec01d9 100644 --- a/layer0/Word.cpp +++ b/layer0/Word.cpp @@ -152,7 +152,7 @@ CWordMatcher *WordMatcherNew(PyMOLGlobals * G, const char *st, CWordMatchOptions int force) { - CWordMatcher *result = NULL; + CWordMatcher *result = nullptr; int needed = force; char wildcard = option->wildcard; @@ -160,7 +160,7 @@ CWordMatcher *WordMatcherNew(PyMOLGlobals * G, const char *st, CWordMatchOptions wildcard = 0; /* space as wildcard means no wildcard */ if(!st) - return NULL; + return nullptr; { /* first determine if we need to incur the overhead of the matcher */ int escape = false; const char *p = st; @@ -488,7 +488,7 @@ int WordMatcherMatchAlpha(CWordMatcher * I, const char *text) int n_node = I->n_node; while((n_node--) > 0) { - if(recursive_match(I, cur_node, text, NULL)) + if(recursive_match(I, cur_node, text, nullptr)) return true; else { while(cur_node->continued) { @@ -665,7 +665,7 @@ int WordListMatch(PyMOLGlobals * G, CWordList * I, const char *name, int ignore_ int WordInit(PyMOLGlobals * G) { - CWord *I = NULL; + CWord *I = nullptr; I = (G->Word = pymol::calloc(1)); if(I) { diff --git a/layer0/ccealignmodule.cpp b/layer0/ccealignmodule.cpp index 32649a2a1..151fde080 100644 --- a/layer0/ccealignmodule.cpp +++ b/layer0/ccealignmodule.cpp @@ -123,7 +123,7 @@ pcePoint getCoords(PyObject* L, int length) pcePoint coords = (pcePoint) malloc(sizeof(cePoint)*length); if (!coords) - return NULL; + return nullptr; // loop through the arguments, pulling out the // XYZ coordinates. @@ -610,7 +610,7 @@ PyObject* findBest( pcePoint coordsA, pcePoint coordsB, pathCache paths, int buf if ( bestRMSD == 1e6 ) { std::cout << "ERROR: Best RMSD found was 1e6. Broken.\n"; - return NULL; + return nullptr; } PyObject* pyU = Py_BuildValue( "[f,f,f,f, f,f,f,f, f,f,f,f, f,f,f,f]", diff --git a/layer0/vla.h b/layer0/vla.h index 71b8b132d..e2a4e1c31 100644 --- a/layer0/vla.h +++ b/layer0/vla.h @@ -44,10 +44,10 @@ template class vla void swap(vla& other) noexcept { std::swap(m_vla, other.m_vla); } public: - // implicit NULL constructor + // implicit nullptr constructor vla() = default; - // NULL assignment + // nullptr assignment vla& operator=(std::nullptr_t) { freeP(); @@ -67,7 +67,7 @@ template class vla explicit vla(std::size_t size) { m_vla = VLACalloc(T, size); } // constructor with initializer list - // Empty list constructs a NULL VLA to be consistent with default constructor + // Empty list constructs a nullptr VLA to be consistent with default constructor vla(std::initializer_list init) { if (init.size() == 0) diff --git a/layer1/Basis.cpp b/layer1/Basis.cpp index 5f19412b2..404f76e56 100644 --- a/layer1/Basis.cpp +++ b/layer1/Basis.cpp @@ -1522,7 +1522,7 @@ int BasisHitPerspective(BasisCallRec * BC) int *cache_cache = cache->Cache; int *cache_CacheLink = cache->CacheLink; - CPrimitive *r_prim = NULL; + CPrimitive *r_prim = nullptr; if(new_ray) { /* see if we can eliminate this ray right away using the mask */ @@ -2023,7 +2023,7 @@ int BasisHitOrthoscopic(BasisCallRec * BC) float r_tri1 = _0, r_tri2 = _0, r_dist = _0; /* zero inits to suppress compiler warnings */ float r_sphere0 = _0, r_sphere1 = _0, r_sphere2 = _0; - CPrimitive *r_prim = NULL; + CPrimitive *r_prim = nullptr; check_interior_flag = BC->check_interior && (!BC->pass); @@ -2349,7 +2349,7 @@ int BasisHitShadow(BasisCallRec * BC) float r_tri1 = _0, r_tri2 = _0, r_dist; /* zero inits to suppress compiler warnings */ float r_sphere0 = _0, r_sphere1 = _0, r_sphere2 = _0; float r_trans = _0; - CPrimitive *r_prim = NULL; + CPrimitive *r_prim = nullptr; /* assumption: always heading in the negative Z direction with our vector... */ vt[0] = r->base[0]; @@ -2823,11 +2823,11 @@ int BasisMakeMap(CBasis * I, int *vert2prim, CPrimitive * prim, int n_prim, float ll; CPrimitive *prm; int i; - int *tempRef = NULL; + int *tempRef = nullptr; int n = 0, h, q, x, y, z, j, k, l, e; int extra_vert = 0; float p[3], dd[3], *d1, *d2, vd[3], cx[3], cy[3]; - float *tempVertex = NULL; + float *tempVertex = nullptr; float xs, ys; int remapMode = true; /* remap mode means that some objects will span more * than one voxel, so we have to worry about populating @@ -3220,7 +3220,7 @@ int BasisMakeMap(CBasis * I, int *vert2prim, CPrimitive * prim, int n_prim, I->Map = MapNewCached(I->G, -sep, tempVertex, n, extent, group_id, block_base); CHECKOK(ok, I->Map); } else { - I->Map = MapNewCached(I->G, sep, tempVertex, n, NULL, group_id, block_base); + I->Map = MapNewCached(I->G, sep, tempVertex, n, nullptr, group_id, block_base); CHECKOK(ok, I->Map); } } @@ -3238,8 +3238,8 @@ int BasisMakeMap(CBasis * I, int *vert2prim, CPrimitive * prim, int n_prim, impact of this optimization is to reduce the size of the express list (I->Map->Elist) array by about 3-fold */ - int *prm_spanner = NULL; - int *spanner = NULL; + int *prm_spanner = nullptr; + int *spanner = nullptr; float *v = tempVertex; int j, k, l, jj, kk, ll; int nVertex = I->NVertex; @@ -3548,11 +3548,11 @@ int BasisMakeMap(CBasis * I, int *vert2prim, CPrimitive * prim, int n_prim, } else { /* simple sphere mode */ - I->Map = MapNewCached(I->G, -sep, I->Vertex, I->NVertex, NULL, group_id, block_base); + I->Map = MapNewCached(I->G, -sep, I->Vertex, I->NVertex, nullptr, group_id, block_base); CHECKOK(ok, I->Map); if (ok){ if(perspective) { - ok &= MapSetupExpressPerp(I->Map, I->Vertex, front, I->NVertex, false, NULL); + ok &= MapSetupExpressPerp(I->Map, I->Vertex, front, I->NVertex, false, nullptr); } else { ok &= MapSetupExpressXYVert(I->Map, I->Vertex, I->NVertex, false); } @@ -3567,11 +3567,11 @@ int BasisInit(PyMOLGlobals * G, CBasis * I, int group_id) { int ok = true; I->G = G; - I->Radius = NULL; - I->Radius2 = NULL; - I->Normal = NULL; - I->Vert2Normal = NULL; - I->Precomp = NULL; + I->Radius = nullptr; + I->Radius2 = nullptr; + I->Normal = nullptr; + I->Vert2Normal = nullptr; + I->Precomp = nullptr; I->Vertex = VLACacheAlloc(I->G, float, 1, group_id, cCache_basis_vertex); CHECKOK(ok, I->Vertex); if (ok) @@ -3589,7 +3589,7 @@ int BasisInit(PyMOLGlobals * G, CBasis * I, int group_id) if (ok) I->Precomp = VLACacheAlloc(I->G, float, 1, group_id, cCache_basis_precomp); CHECKOK(ok, I->Precomp); - I->Map = NULL; + I->Map = nullptr; I->NVertex = 0; I->NNormal = 0; return ok; @@ -3601,7 +3601,7 @@ void BasisFinish(CBasis * I, int group_id) { if(I->Map) { MapFree(I->Map); - I->Map = NULL; + I->Map = nullptr; } VLACacheFreeP(I->G, I->Radius2, group_id, cCache_basis_radius2, false); VLACacheFreeP(I->G, I->Radius, group_id, cCache_basis_radius, false); @@ -3609,7 +3609,7 @@ void BasisFinish(CBasis * I, int group_id) VLACacheFreeP(I->G, I->Vert2Normal, group_id, cCache_basis_vert2normal, false); VLACacheFreeP(I->G, I->Normal, group_id, cCache_basis_normal, false); VLACacheFreeP(I->G, I->Precomp, group_id, cCache_basis_precomp, false); - I->Vertex = NULL; + I->Vertex = nullptr; } diff --git a/layer1/ButMode.cpp b/layer1/ButMode.cpp index df9ebb50f..d1a048ebd 100644 --- a/layer1/ButMode.cpp +++ b/layer1/ButMode.cpp @@ -479,7 +479,7 @@ static bool ButModeDrawFastImpl(Block * block, short definitely , CGO *orthoCGO) /*========================================================================*/ int ButModeInit(PyMOLGlobals * G) { - CButMode *I = NULL; + CButMode *I = nullptr; if((I = (G->ButMode = new CButMode(G)))) { int a; diff --git a/layer1/CGO.cpp b/layer1/CGO.cpp index e5aaa0594..64516f1ef 100644 --- a/layer1/CGO.cpp +++ b/layer1/CGO.cpp @@ -415,7 +415,7 @@ CGO *CGONewFromPyList(PyMOLGlobals * G, PyObject * list, int version, bool shoul int ok = true; auto I = CGONew(G); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO ENABLE BACKWARDS COMPATIBILITY... @@ -435,7 +435,7 @@ CGO *CGONewFromPyList(PyMOLGlobals * G, PyObject * list, int version, bool shoul CGOFree(I); } { - CGO *cgo = NULL; + CGO *cgo = nullptr; if (shouldCombine && I && I->has_begin_end){ cgo = CGOCombineBeginEnd(I, 0); CGOFree(I); @@ -502,7 +502,7 @@ static float *CGO_add(CGO * I, unsigned c) float *at; VLACheck(I->op, float, I->c + c); if (!I->op){ - return NULL; + return nullptr; } at = I->op + I->c; I->c += c; @@ -514,7 +514,7 @@ static float *CGO_size(CGO * I, int sz) float *at; VLASize(I->op, float, sz); if (!I->op){ - return NULL; + return nullptr; } at = I->op + I->c; I->c = sz; @@ -1496,7 +1496,7 @@ CGO *CGODrawText(const CGO * I, int est, float *camera) if (cgo && cgo->has_begin_end){ /* this is mainly for VFontWriteToCGO() that still creates CGOBegin/CGOEnd */ if(cgo && cgo->has_begin_end){ - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; convertcgo = CGOCombineBeginEnd(cgo, 0); CGOFree(cgo); cgo = convertcgo; @@ -1541,7 +1541,7 @@ bool CGOCombineBeginEnd(CGO ** I, bool do_not_split_lines) { CGO *cgo = CGOCombineBeginEnd(*I, 0, do_not_split_lines); CGOFree(*I); *I = cgo; - return (cgo != NULL); + return (cgo != nullptr); } /** @@ -1559,7 +1559,7 @@ CGO *CGOCombineBeginEnd(const CGO * I, int est, bool do_not_split_lines) int ok = true; if (!I) - return NULL; + return nullptr; cgo = CGONewSized(I->G, 0); ok &= cgo ? true : false; @@ -2288,8 +2288,8 @@ static int OptimizePointsToVBO(const CGO *I, CGO *cgo, int num_total_vertices_po }*/ if (shouldCompress){ int cnt, nxtn = VERTEX_POS_SIZE, incr = 0; - float *vertexValsDA = NULL, *nxtVals = NULL, *colorValsDA = NULL, *normalValsDA = NULL; - float *pickColorValsDA = NULL, *pickColorValsTMP; + float *vertexValsDA = nullptr, *nxtVals = nullptr, *colorValsDA = nullptr, *normalValsDA = nullptr; + float *pickColorValsDA = nullptr, *pickColorValsTMP; nxtVals = vertexValsDA = sp->floatdata; @@ -2767,10 +2767,10 @@ static bool CGOProcessScreenCGOtoArrays(PyMOLGlobals* G, CGO* cgo, } bool CGOOptimizeToVBONotIndexed(CGO ** I) { - CGO *cgo = CGOOptimizeToVBONotIndexed(*I, 0, true, NULL); + CGO *cgo = CGOOptimizeToVBONotIndexed(*I, 0, true, nullptr); CGOFree(*I); *I = cgo; - return (cgo != NULL); + return (cgo != nullptr); } /** @@ -2811,7 +2811,7 @@ CGO *CGOOptimizeToVBONotIndexed(const CGO * I, int est, bool addshaders, float * if (num_total_vertices_points>0){ if (!OptimizePointsToVBO(I, cgo, num_total_vertices_points, min, max, &has_draw_buffer, addshaders)){ CGOFree(cgo); - return NULL; + return nullptr; } } if (num_total_indexes>0){ @@ -3239,7 +3239,7 @@ CGO *CGOOptimizeToVBOIndexed(const CGO * I, int est, PRINTFB(I->G, FB_CGO, FB_Errors) "ERROR: CGOOptimizeToVBOIndexed() VBO Memory Limitation: The requested \n operation requires a larger buffer than PyMOL currently allows. \n The operation has not entirely completed successfully.\n" ENDFB(I->G); firePyMOLLimitationWarning(); CGOFree(cgo); - return NULL; + return nullptr; } #endif @@ -3247,7 +3247,7 @@ CGO *CGOOptimizeToVBOIndexed(const CGO * I, int est, /* This does not need to be indexed (for now) */ if (!OptimizePointsToVBO(I, cgo, num_total_vertices_points, min, max, &has_draw_buffer, addshaders)){ CGOFree(cgo); - return NULL; + return nullptr; } } @@ -3258,7 +3258,7 @@ CGO *CGOOptimizeToVBOIndexed(const CGO * I, int est, uchar *colorValsUC = 0; uchar *normalValsC = 0; short ambient_occlusion = 0; - float *sumarray = NULL; + float *sumarray = nullptr; int n_data = 0; if (embedTransparencyInfo){ @@ -3560,7 +3560,7 @@ CGO *CGOOptimizeToVBOIndexed(const CGO * I, int est, FreeP(vertexVals); } if (ok && num_total_vertices_lines>0){ - float *vertexVals = 0, *colorVals = 0, *normalVals = NULL, *nxtVals; + float *vertexVals = 0, *colorVals = 0, *normalVals = nullptr, *nxtVals; float *pickColorVals; uchar *colorValsUC = 0; uchar *normalValsC = 0; @@ -3849,7 +3849,7 @@ struct OptimizeSphereData * @param[out] cgo output CGO * @param[in] num_total_spheres Number of spheres to optimize * @param[out] leftOverCGO CGO data not relevant to spheres. - * @pre cgo must not be NULL + * @pre cgo must not be nullptr * * Note: To use leftOverCGO, it must already be preallocated. */ @@ -3997,7 +3997,7 @@ static OptimizeSphereData GetOptimizeSphereData(const CGO* I, CGO*& cgo, int num * @param[in] addshaders adds shader call to CGO * @param[in] num_total_spheres number of total spheres to optimize * @param[in] sphereData Optimized Sphere Data - * @pre cgo must not be NULL + * @pre cgo must not be nullptr */ static bool PopulateGLBufferOptimizedSphereData(const CGO* I, CGO* cgo, bool addshaders, int num_total_spheres, const OptimizeSphereData& sphereData) @@ -4155,7 +4155,7 @@ CGO *CGOSimplify(const CGO * I, int est, short sphere_quality, bool stick_round_ auto G = I->G; int ok = true; if (sphere_quality < 0){ - sphere_quality = SettingGet_i(I->G, NULL, NULL, cSetting_cgo_sphere_quality); + sphere_quality = SettingGet_i(I->G, nullptr, nullptr, cSetting_cgo_sphere_quality); } std::unique_ptr cgo_managed(CGONew(G, I->c + est)); @@ -4203,10 +4203,10 @@ CGO *CGOSimplify(const CGO * I, int est, short sphere_quality, bool stick_round_ ok &= CGOSimpleCylinder(cgo, cyl->origin, v1, cyl->tube_size, color1, cyl->color2, cgo->alpha, alpha2, true, bcap, fcap, &pickcolor2, stick_round_nub); } else { ok &= CGOColorv(cgo, color1); - ok &= CGOSimpleCylinder(cgo, cyl->origin, mid, cyl->tube_size, color1, NULL, cgo->alpha, alpha2, false, fcap, cCylCap::None, nullptr, stick_round_nub); + ok &= CGOSimpleCylinder(cgo, cyl->origin, mid, cyl->tube_size, color1, nullptr, cgo->alpha, alpha2, false, fcap, cCylCap::None, nullptr, stick_round_nub); ok &= CGOColorv(cgo, cyl->color2); ok &= CGOPickColor(cgo, pickcolor2.index, pickcolor2.bond); - ok &= CGOSimpleCylinder(cgo, mid, v1, cyl->tube_size, cyl->color2, NULL, cgo->alpha, alpha2, false, cCylCap::None, bcap, nullptr, stick_round_nub); + ok &= CGOSimpleCylinder(cgo, mid, v1, cyl->tube_size, cyl->color2, nullptr, cgo->alpha, alpha2, false, cCylCap::None, bcap, nullptr, stick_round_nub); } } break; @@ -4455,7 +4455,7 @@ CGO *CGOSimplifyNoCompress(const CGO * I, int est, short sphere_quality, bool st int ok = true; if (sphere_quality < 0){ - sphere_quality = SettingGet_i(I->G, NULL, NULL, cSetting_cgo_sphere_quality); + sphere_quality = SettingGet_i(I->G, nullptr, nullptr, cSetting_cgo_sphere_quality); } cgo = CGONewSized(I->G, I->c + est); @@ -4580,7 +4580,7 @@ CGO *CGOSimplifyNoCompress(const CGO * I, int est, short sphere_quality, bool st CGO *CGOOptimizeTextures(const CGO * I, int est) { - CGO *cgo = NULL; + CGO *cgo = nullptr; int num_total_textures; int ok = true; num_total_textures = CGOCountNumberOfOperationsOfType(I, CGO_DRAW_TEXTURE); @@ -4591,20 +4591,20 @@ CGO *CGOOptimizeTextures(const CGO * I, int est) worldPos = pymol::malloc(num_total_textures * 18); if (!worldPos){ PRINTFB(I->G, FB_CGO, FB_Errors) "ERROR: CGOOptimizeTextures() worldPos could not be allocated\n" ENDFB(I->G); - return NULL; + return nullptr; } screenValues = pymol::malloc(num_total_textures * 18); if (!screenValues){ PRINTFB(I->G, FB_CGO, FB_Errors) "ERROR: CGOOptimizeTextures() screenValues could not be allocated\n" ENDFB(I->G); FreeP(worldPos); - return NULL; + return nullptr; } textExtents = pymol::malloc(num_total_textures * 12); if (!textExtents){ PRINTFB(I->G, FB_CGO, FB_Errors) "ERROR: CGOOptimizeTextures() textExtents could not be allocated\n" ENDFB(I->G); FreeP(screenValues); FreeP(worldPos); - return NULL; + return nullptr; } pickColorVals = pymol::malloc(num_total_textures * 12); /* pick index and bond */ if (!pickColorVals){ @@ -4612,7 +4612,7 @@ CGO *CGOOptimizeTextures(const CGO * I, int est) FreeP(textExtents); FreeP(screenValues); FreeP(worldPos); - return NULL; + return nullptr; } cgo = CGONewSized(I->G, 0); @@ -4793,7 +4793,7 @@ CGO *CGOConvertToLabelShader(const CGO *I, CGO * addTo){ CGO *CGOOptimizeLabels(const CGO * I, int est, bool addshaders) { - CGO *cgo = NULL; + CGO *cgo = nullptr; int num_total_labels; int ok = true; num_total_labels = CGOCountNumberOfOperationsOfType(I, CGO_DRAW_LABEL); @@ -4804,7 +4804,7 @@ CGO *CGOOptimizeLabels(const CGO * I, int est, bool addshaders) worldPos = pymol::malloc(num_total_labels * 6 * 17); if (!worldPos){ PRINTFB(I->G, FB_CGO, FB_Errors) "ERROR: CGOOptimizeLabels() worldPos could not be allocated\n" ENDFB(I->G); - return NULL; + return nullptr; } screenValues = worldPos + (num_total_labels * 18); targetPos = screenValues + (num_total_labels * 18); @@ -4922,7 +4922,7 @@ CGO *CGOOptimizeLabels(const CGO * I, int est, bool addshaders) }; if (ok) { - float *pickArray = NULL; + float *pickArray = nullptr; if (addshaders){ CGOEnable(cgo, GL_LABEL_SHADER); } @@ -4952,7 +4952,7 @@ CGO *CGOOptimizeLabels(const CGO * I, int est, bool addshaders) CGO *CGOOptimizeConnectors(const CGO * I, int est) { - CGO *cgo = NULL; + CGO *cgo = nullptr; int num_total_connectors; int ok = true; int use_geometry_shaders = SettingGetGlobal_b(I->G, cSetting_use_geometry_shaders); @@ -4963,12 +4963,12 @@ CGO *CGOOptimizeConnectors(const CGO * I, int est) float *targetPt3d, *labelCenterPt3d, *indentFactor, *screenWorldOffset, *connectorColor, *textSize; float *bkgrdColor, *relExtLength, *connectorWidth; uchar *relativeMode, *drawBkgrd; - uchar *isCenterPt = NULL; + uchar *isCenterPt = nullptr; int place3 = 0, place2 = 0, place = 0; targetPt3d = pymol::calloc(num_total_connectors * 20 * factor); /* too much, relativeMode only needs 1 byte per vertex, instead of 1 float */ if (!targetPt3d){ PRINTFB(I->G, FB_CGO, FB_Errors) "ERROR: CGOOptimizeConnectors() could not be allocated\n" ENDFB(I->G); - return NULL; + return nullptr; } labelCenterPt3d = targetPt3d + (num_total_connectors*3 * factor); indentFactor = labelCenterPt3d + (num_total_connectors*3 * factor); @@ -5369,14 +5369,14 @@ int CGORenderRay(CGO * I, CRay * ray, RenderInfo * info, const float *color, Obj float white[] = { 1.0, 1.0, 1.0 }; float zee[] = { 0.0, 0.0, 1.0 }; int ok = true; - const float *n0 = NULL, *n1 = NULL, *n2 = NULL, *v0 = NULL, *v1 = NULL, *v2 = NULL, *c0 = - NULL, *c1 = NULL, *c2 = NULL; + const float *n0 = nullptr, *n1 = nullptr, *n2 = nullptr, *v0 = nullptr, *v1 = nullptr, *v2 = nullptr, *c0 = + nullptr, *c1 = nullptr, *c2 = nullptr; float rampc0[3], rampc1[3], rampc2[3]; int mode = -1; /* workaround; multi-state ray-trace bug */ if (!I) { assert("TODO investigate" && false); - return 0; /* not sure if it should return 0 or 1, 0 - fails, but is it a memory issue? might not be since the arg is NULL */ + return 0; /* not sure if it should return 0 or 1, 0 - fails, but is it a memory issue? might not be since the arg is nullptr */ } I->G->CGORenderer->alpha = @@ -5991,9 +5991,9 @@ static int CGOSimpleEllipsoid(CGO* I, const float* v, float vdw, scale_sq[1] = scale[1] * scale[1]; scale_sq[2] = scale[2] * scale[2]; - ds = SettingGet_i(I->G, NULL, NULL, cSetting_cgo_ellipsoid_quality); + ds = SettingGet_i(I->G, nullptr, nullptr, cSetting_cgo_ellipsoid_quality); if(ds < 0) - ds = SettingGet_i(I->G, NULL, NULL, cSetting_ellipsoid_quality); + ds = SettingGet_i(I->G, nullptr, nullptr, cSetting_ellipsoid_quality); if(ds < 0) ds = 0; if(ds > 3) @@ -6654,7 +6654,7 @@ void CGO::move_append(CGO&& src_) /** * Appends `src` to the end of this CGO and then free's `src` - * and sets the pointer to NULL. + * and sets the pointer to nullptr. */ void CGO::free_append(CGO * &src) { free_append(std::move(src)); @@ -6808,7 +6808,7 @@ CGO *CGOConvertLinesToShaderCylinders(const CGO * I, int est){ break; case CGO_BEGIN: { - const float *last_vertex = NULL, *last_color = NULL, *current_color = NULL, *color = NULL ; + const float *last_vertex = nullptr, *last_color = nullptr, *current_color = nullptr, *color = nullptr ; unsigned int last_pick_color_idx = 0; int last_pick_color_bnd = cPickableNoPick ; int nverts = 0, err = 0; @@ -6853,8 +6853,8 @@ CGO *CGOConvertLinesToShaderCylinders(const CGO * I, int est){ tot_ncyls++; } if (mode==GL_LINES){ - last_vertex = NULL; - last_color = NULL; + last_vertex = nullptr; + last_color = nullptr; } } } else { @@ -6932,7 +6932,7 @@ CGO *CGOConvertLinesToShaderCylinders(const CGO * I, int est){ return (cgo); } else { CGOFree(cgo); - return NULL; + return nullptr; } } @@ -7029,8 +7029,8 @@ CGO *CGOSplitUpLinesForPicking(const CGO * I){ last_pick_color_bnd = cgo->current_pick_color_bond; } if (mode==GL_LINES){ - last_vertex = NULL; - last_color = NULL; + last_vertex = nullptr; + last_color = nullptr; } } } else { @@ -7240,9 +7240,9 @@ CGO* CGOColorByRamp(PyMOLGlobals* G, const CGO* I, ObjectGadgetRamp* ramp, int ok = true; float white[3] = { 1.f, 1.f, 1.f}; - float probe_radius = SettingGet_f(G, set1, NULL, cSetting_solvent_radius); + float probe_radius = SettingGet_f(G, set1, nullptr, cSetting_solvent_radius); float v_above[3], n0[3] = { 0.f, 0.f, 0.f }; - int ramp_above = SettingGet_i(G, set1, NULL, cSetting_surface_ramp_above_mode) == 1; + int ramp_above = SettingGet_i(G, set1, nullptr, cSetting_surface_ramp_above_mode) == 1; for (auto it = I->begin(); ok && !it.is_stop(); ++it) { const auto op = it.op_code(); @@ -7634,7 +7634,7 @@ CGO *CGOConvertTrianglesToAlpha(const CGO * I){ return (cgo); } else { CGOFree(cgo); - return NULL; + return nullptr; } } @@ -8054,7 +8054,7 @@ CGO *CGOConvertLinesToTrilines(const CGO * I, bool addshaders){ int line_counter = 0; GLuint glbuff = 0; - const float *colorv = NULL; + const float *colorv = nullptr; unsigned int buff_size = nLines * 6 * (8 * sizeof(float)); // VBO memory -- number of lines x 4 vertices per line x (vertex + otherVertex + normal + texCoord + color) @@ -8113,8 +8113,8 @@ CGO *CGOConvertLinesToTrilines(const CGO * I, bool addshaders){ last_vertex = pc; } if (mode==GL_LINES){ - last_vertex = NULL; - last_color = NULL; + last_vertex = nullptr; + last_color = nullptr; } } } else { @@ -8398,7 +8398,7 @@ void copyAttributeForVertex(bool isInterleaved, int &nvert, AttribDesc &attribDe const int vertexDataSize, std::vector &dataPtrs, std::vector &attrOffset){ int ord = attribDesc.order; void *dataPtr = dataPtrs[ord]; - unsigned char *pc = NULL; + unsigned char *pc = nullptr; auto attrSize = GetSizeOfVertexFormat(attribDesc.m_format); if (isInterleaved){ dataPtr = (unsigned char*) dataPtr + nvert * vertexDataSize + attrOffset[ord]; @@ -8718,7 +8718,7 @@ CGO *CGOConvertToShader(const CGO *I, AttribDataDesc &attrData, AttribDataDesc & // - pickvbo is interleaved so that for multiple channels, pick data for each vertex // is contiguous VertexBuffer *vbo = I->G->ShaderMgr->newGPUBuffer(layout); - VertexBuffer *pickvbo = NULL; + VertexBuffer *pickvbo = nullptr; if (pickDataSize){ pickvbo = I->G->ShaderMgr->newGPUBuffer(VertexBuffer::SEQUENTIAL, GL_DYNAMIC_DRAW); pickvbohash = pickvbo->get_hash_id(); @@ -8794,9 +8794,9 @@ CGO *CGOConvertToShader(const CGO *I, AttribDataDesc &attrData, AttribDataDesc & allAttrBS |= (1 << attrDesc->order); } auto attrOffset = *attrOffsetIt; - unsigned char *first_value = NULL; + unsigned char *first_value = nullptr; first_value = (attrDesc->default_value ? attrDesc->default_value : - (attrDesc->repeat_value ? attrDesc->repeat_value : NULL)); + (attrDesc->repeat_value ? attrDesc->repeat_value : nullptr)); if (first_value){ auto attrSize = GetSizeOfVertexFormat(attrDesc->m_format); memcpy(((unsigned char*)allData)+attrOffset, first_value, attrSize); @@ -8814,9 +8814,9 @@ CGO *CGOConvertToShader(const CGO *I, AttribDataDesc &attrData, AttribDataDesc & allAttrBS |= (1 << attrDesc.order); } dataPtrs.push_back(curAllDataPtr); - unsigned char *first_value = NULL; + unsigned char *first_value = nullptr; first_value = (attrDesc.default_value ? attrDesc.default_value : - (attrDesc.repeat_value ? attrDesc.repeat_value : NULL)); + (attrDesc.repeat_value ? attrDesc.repeat_value : nullptr)); if (first_value){ memcpy((unsigned char*)curAllDataPtr, first_value, attrSizes[pl]); } @@ -9246,7 +9246,7 @@ CGO *CGOConvertLinesToCylinderShader(const CGO *I, CGO *addTo, bool add_color){ int box_indices[36] = { // box indices 0, 2, 1, 2, 0, 3, 1, 6, 5, 6, 1, 2, 0, 1, 5, 5, 4, 0, 0, 7, 3, 7, 0, 4, 3, 6, 2, 6, 3, 7, 4, 5, 6, 6, 7, 4 }; - int *box_indices_ptr = NULL; + int *box_indices_ptr = nullptr; box_indices_ptr = box_indices; bool interp_same, interp_value = false; @@ -9332,7 +9332,7 @@ CGO *CGOConvertCrossesToCylinderShader(const CGO *I, CGO *addTo, float cross_siz int box_indices[36] = { // box indices 0, 2, 1, 2, 0, 3, 1, 6, 5, 6, 1, 2, 0, 1, 5, 5, 4, 0, 0, 7, 3, 7, 0, 4, 3, 6, 2, 6, 3, 7, 4, 5, 6, 6, 7, 4 }; - int *box_indices_ptr = NULL; + int *box_indices_ptr = nullptr; box_indices_ptr = box_indices; addTo->add(G->ShaderMgr->GetAttributeUID("a_cap"), cCylShaderBothCapsRound); @@ -9534,8 +9534,8 @@ CGO *CGOConvertShaderCylindersToCylinderShader(const CGO *I, CGO *addTo){ AttribDesc *fdesc; static unsigned char cyl_flags[] = { 0, 4, 6, 2, 1, 5, 7, 3 }; // right(4)/up(2)/out(1) - attrDesc[1].attrOps[0].funcDataConversions.push_back( { SetVertexFromOriginAxisForCylinder, NULL, "attr_vertex2" } ); - attrDesc[1].attrOps[1].funcDataConversions.push_back( { SetVertexFromOriginAxisForCylinder, NULL, "attr_vertex2" } ); + attrDesc[1].attrOps[0].funcDataConversions.push_back( { SetVertexFromOriginAxisForCylinder, nullptr, "attr_vertex2" } ); + attrDesc[1].attrOps[1].funcDataConversions.push_back( { SetVertexFromOriginAxisForCylinder, nullptr, "attr_vertex2" } ); attrDesc.push_back({"attr_flags", VertexFormat::UByte}); fdesc = &attrDesc[attrDesc.size()-1]; @@ -9553,7 +9553,7 @@ CGO *CGOConvertShaderCylindersToCylinderShader(const CGO *I, CGO *addTo){ int box_indices[36] = { // box indices 0, 2, 1, 2, 0, 3, 1, 6, 5, 6, 1, 2, 0, 1, 5, 5, 4, 0, 0, 7, 3, 7, 0, 4, 3, 6, 2, 6, 3, 7, 4, 5, 6, 6, 7, 4 }; - int *box_indices_ptr = NULL; + int *box_indices_ptr = nullptr; box_indices_ptr = box_indices; bool interp_same; diff --git a/layer1/CGO.h b/layer1/CGO.h index e23c83f1c..22883bfdb 100644 --- a/layer1/CGO.h +++ b/layer1/CGO.h @@ -642,7 +642,7 @@ namespace cgo { struct shadercylinder2ndcolor { static const int op_code = CGO_SHADER_CYLINDER_WITH_2ND_COLOR; shadercylinder2ndcolor(CGO *I, const float *_origin, const float *_axis, const float _radius, - int _cap, const float *_color2, Pickable *pickcolor2 = NULL, + int _cap, const float *_color2, Pickable *pickcolor2 = nullptr, const float alpha = -1.f); float origin[3], axis[3], tube_size; int cap; @@ -959,7 +959,7 @@ void CGOFreeVBOs(CGO *I); CGO *CGOOptimizeToVBOIndexed(const CGO * I, int est=0, const float *color=NULL, bool addshaders=true, bool embedTransparencyInfo=false); #define CGOOptimizeToVBOIndexedWithColorEmbedTransparentInfo(I, est, color, addshaders) CGOOptimizeToVBOIndexed(I, est, color, addshaders, true) #define CGOOptimizeToVBOIndexedWithColor CGOOptimizeToVBOIndexed -#define CGOOptimizeToVBOIndexedNoShader(I, est) CGOOptimizeToVBOIndexed(I, est, NULL, false) +#define CGOOptimizeToVBOIndexedNoShader(I, est) CGOOptimizeToVBOIndexed(I, est, nullptr, false) bool CGOOptimizeToVBONotIndexed(CGO ** I); CGO* CGOOptimizeToVBONotIndexed(const CGO* I, int est = 0, @@ -970,7 +970,7 @@ CGO* CGOOptimizeToVBONotIndexed(const CGO* I, int est = 0, CGO *CGOOptimizeSpheresToVBONonIndexed(const CGO * I, int est=0, bool addshaders=false, CGO *leftOverCGO=NULL); -#define CGOOptimizeSpheresToVBONonIndexedNoShader(I, est) CGOOptimizeSpheresToVBONonIndexed(I, est, false, NULL) +#define CGOOptimizeSpheresToVBONonIndexedNoShader(I, est) CGOOptimizeSpheresToVBONonIndexed(I, est, false, nullptr) /** * Creates a VBO-based Bezier CGO. diff --git a/layer1/CGOGL.cpp b/layer1/CGOGL.cpp index 369bbced4..0ff3a21f4 100644 --- a/layer1/CGOGL.cpp +++ b/layer1/CGOGL.cpp @@ -149,7 +149,7 @@ static void CGO_gl_vertex_cross(CCGORenderer* I, CGO_op_data v) } #ifndef PURE_OPENGL_ES_2 } else { - CSetting *set1 = NULL, *set2 = NULL; + CSetting *set1 = nullptr, *set2 = nullptr; if (I->rep && I->rep->cs) set1 = I->rep->cs->Setting.get(); if (I->rep && I->rep->obj) @@ -542,7 +542,7 @@ static void CGO_gl_draw_buffers_indexed(CCGORenderer* I, CGO_op_data pc) int* ix = (int*) (z_value + n_tri); int* sort_mem = ix + n_tri; int t_mode; - CSetting *set1 = NULL, *set2 = NULL; + CSetting *set1 = nullptr, *set2 = nullptr; if (I->rep && I->rep->cs) set1 = I->rep->cs->Setting.get(); if (I->rep && I->rep->obj) @@ -675,7 +675,7 @@ static void CGO_gl_draw_custom(CCGORenderer* I, CGO_op_data pc) VertexBuffer* vbo = I->G->ShaderMgr->getGPUBuffer(sp->vboid); if (!vbo) return; - IndexBuffer* ibo = NULL; + IndexBuffer* ibo = nullptr; if (sp->iboid) { ibo = I->G->ShaderMgr->getGPUBuffer(sp->iboid); } @@ -837,7 +837,7 @@ static void CGO_gl_draw_labels(CCGORenderer* I, CGO_op_data pc) I->info ? I->info->pass : RenderPass::Antialias); if (I->rep) { float label_size; - CSetting *set1 = NULL, *set2 = NULL; + CSetting *set1 = nullptr, *set2 = nullptr; if (I->rep->cs) set1 = I->rep->cs->Setting.get(); if (I->rep->obj) @@ -899,8 +899,8 @@ static void CGO_gl_draw_connectors(CCGORenderer* I, CGO_op_data pc) } if (I->rep) { float label_size; - CSetting *set1 = NULL, *set2 = NULL; - float v_scale = SceneGetScreenVertexScale(I->G, NULL); + CSetting *set1 = nullptr, *set2 = nullptr; + float v_scale = SceneGetScreenVertexScale(I->G, nullptr); if (I->rep->cs) set1 = I->rep->cs->Setting.get(); if (I->rep->obj) @@ -1053,7 +1053,7 @@ static void CGO_gl_linewidth(CCGORenderer* I, CGO_op_data pc) * call glLineWidth and set the "line_width" uniform */ static void glLineWidthAndUniform( - float line_width, CShaderPrg* shaderPrg = NULL) + float line_width, CShaderPrg* shaderPrg = nullptr) { #ifndef _WEBGL glLineWidth(line_width); @@ -1072,9 +1072,9 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) bool openVR = SceneGetStereo(I->G) == cStereo_openvr; char varwidth = 0; float vScale = - (I->info ? I->info->vertex_scale : SceneGetScreenVertexScale(I->G, NULL)); + (I->info ? I->info->vertex_scale : SceneGetScreenVertexScale(I->G, nullptr)); - CSetting *csSetting = NULL, *objSetting = NULL; + CSetting *csSetting = nullptr, *objSetting = nullptr; auto shaderPrg = I->G->ShaderMgr->Get_Current_Shader(); if (I->rep && I->rep->cs) { csSetting = I->rep->cs->Setting.get(); @@ -1084,7 +1084,7 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) } switch (mode) { case LINEWIDTH_DYNAMIC_WITH_SCALE_RIBBON: { - float line_width = SettingGet_f(I->G, NULL, NULL, cSetting_ribbon_width); + float line_width = SettingGet_f(I->G, nullptr, nullptr, cSetting_ribbon_width); if (!openVR) line_width = SceneGetDynamicLineWidth(I->info, line_width); if (I->info && I->info->width_scale_flag) { @@ -1093,7 +1093,7 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) glLineWidthAndUniform(line_width, shaderPrg); } break; case LINEWIDTH_DYNAMIC_WITH_SCALE_DASH: { - float line_width = SettingGet_f(I->G, NULL, NULL, cSetting_dash_width); + float line_width = SettingGet_f(I->G, nullptr, nullptr, cSetting_dash_width); if (!openVR) line_width = SceneGetDynamicLineWidth(I->info, line_width); if (I->info && I->info->width_scale_flag) { @@ -1102,7 +1102,7 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) glLineWidthAndUniform(line_width, shaderPrg); } break; case LINEWIDTH_DYNAMIC_WITH_SCALE: { - float line_width = SettingGet_f(I->G, NULL, NULL, cSetting_line_width); + float line_width = SettingGet_f(I->G, nullptr, nullptr, cSetting_line_width); if (!openVR) line_width = SceneGetDynamicLineWidth(I->info, line_width); if (I->info && I->info->width_scale_flag) { @@ -1111,7 +1111,7 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) glLineWidthAndUniform(line_width, shaderPrg); } break; case LINEWIDTH_WITH_SCALE: { - float line_width = SettingGet_f(I->G, NULL, NULL, cSetting_line_width); + float line_width = SettingGet_f(I->G, nullptr, nullptr, cSetting_line_width); if (I->info && I->info->width_scale_flag) { line_width *= I->info->width_scale; } @@ -1123,7 +1123,7 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) line_width = SettingGet_f(I->G, I->rep->cs->Setting.get(), I->rep->obj->Setting.get(), cSetting_mesh_width); } else { - line_width = SettingGet_f(I->G, NULL, NULL, cSetting_mesh_width); + line_width = SettingGet_f(I->G, nullptr, nullptr, cSetting_mesh_width); } if (!openVR) line_width = SceneGetDynamicLineWidth(I->info, line_width); @@ -1147,12 +1147,12 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) break; } case CYLINDERWIDTH_DYNAMIC_MESH: { - CSetting* setting = NULL; + CSetting* setting = nullptr; float mesh_width; if (I && I->rep && I->rep->obj) { setting = I->rep->obj->Setting.get(); } - mesh_width = SettingGet_f(I->G, setting, NULL, cSetting_mesh_width); + mesh_width = SettingGet_f(I->G, setting, nullptr, cSetting_mesh_width); if (shaderPrg) { const float* color = I->color ? I->color : g_ones4f; shaderPrg->Set1f("uni_radius", @@ -1341,7 +1341,7 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) } break; case LINEWIDTH_FOR_LINES: { float line_width = SceneGetDynamicLineWidth( - I->info, SettingGet_f(I->G, NULL, NULL, cSetting_line_width)); + I->info, SettingGet_f(I->G, nullptr, nullptr, cSetting_line_width)); if (I->info && I->info->width_scale_flag) { line_width *= I->info->width_scale; } @@ -1350,7 +1350,7 @@ static void CGO_gl_special(CCGORenderer* I, CGO_op_data pc) case SET_LABEL_SCALE_UNIFORMS: { if (I->rep) { float label_size; - CSetting *set1 = NULL, *set2 = NULL; + CSetting *set1 = nullptr, *set2 = nullptr; if (I->rep->cs) set1 = I->rep->cs->Setting.get(); if (I->rep->obj) @@ -1741,7 +1741,7 @@ static void CGO_gl_sphere(CCGORenderer* I, CGO_op_data varg) if (I->isPicking) { SphereRender(I->G, 0, v, I->color, I->alpha, v[3]); } else { - SphereRender(I->G, I->sphere_quality, v, NULL, I->alpha, v[3]); + SphereRender(I->G, I->sphere_quality, v, nullptr, I->alpha, v[3]); } } @@ -1899,7 +1899,7 @@ static int* get_pickcolorsset_ptr(int op, float* pc) RETURN_PICKCOLORSETPTR_CASE(cylinder_buffers); RETURN_PICKCOLORSETPTR_CASE(custom); } - return NULL; + return nullptr; } void CGORenderGLPicking(CGO* I, RenderInfo* info, PickContext* context, @@ -2014,7 +2014,7 @@ void CGORenderGLPicking(CGO* I, RenderInfo* info, PickContext* context, int srcp; float* pca = nullptr; int* pickDataSrc; - uchar* pickColorDestUC = NULL; + uchar* pickColorDestUC = nullptr; bool free_pick_color_dest = false; int destOffset = 0, bufsizemult = 1; size_t pickvbo = 0; @@ -2144,7 +2144,7 @@ void CGORenderGLPicking(CGO* I, RenderInfo* info, PickContext* context, if (free_pick_color_dest) { delete[] pickColorDestUC; - pickColorDestUC = NULL; + pickColorDestUC = nullptr; free_pick_color_dest = false; } } @@ -2248,11 +2248,11 @@ void CGORenderGL(CGO* I, const float* color, CSetting* set1, CSetting* set2, int mode = -1; int vc = 0; // triangle normals - const float *n0 = NULL, *n1 = NULL, *n2 = NULL; + const float *n0 = nullptr, *n1 = nullptr, *n2 = nullptr; // triangle vertices - const float *v0 = NULL, *v1 = NULL, *v2 = NULL; + const float *v0 = nullptr, *v1 = nullptr, *v2 = nullptr; // triangle colors - const float *c0 = color, *c1 = NULL, *c2 = NULL; + const float *c0 = color, *c1 = nullptr, *c2 = nullptr; for (auto it = I->begin(); !it.is_stop(); ++it) { const auto op = it.op_code(); diff --git a/layer1/COLLADA.cpp b/layer1/COLLADA.cpp index 16273b930..5b3ed45bd 100644 --- a/layer1/COLLADA.cpp +++ b/layer1/COLLADA.cpp @@ -281,27 +281,27 @@ static void ColladaWritePhongEffect(xmlTextWriterPtr w, char *id, if (amb > PRECISION) { sprintf(value, "0.5 0.5 0.5 %5.3f", amb); - ColladaWriteCommonColorElement(w, (char *)"ambient", NULL, value); + ColladaWriteCommonColorElement(w, (char *)"ambient", nullptr, value); } if (spec > PRECISION) { sprintf(value, "0.5 0.5 0.5 %5.3f", spec); - ColladaWriteCommonColorElement(w, (char *)"specular", NULL, value); + ColladaWriteCommonColorElement(w, (char *)"specular", nullptr, value); } if(shin > PRECISION) { sprintf(value, "%5.3f", shin); - ColladaWriteCommonFloatElement(w, (char *)"shininess", NULL, value); + ColladaWriteCommonFloatElement(w, (char *)"shininess", nullptr, value); } if(trans > PRECISION) { sprintf(value, "%5.3f", trans); - ColladaWriteCommonFloatElement(w, (char *)"transparency", NULL, value); + ColladaWriteCommonFloatElement(w, (char *)"transparency", nullptr, value); } if(iref > PRECISION) { sprintf(value, "%5.3f", iref); - ColladaWriteCommonFloatElement(w, (char *)"index_of_refraction", NULL, value); + ColladaWriteCommonFloatElement(w, (char *)"index_of_refraction", nullptr, value); } xmlTextWriterEndElement(w); // phong @@ -750,20 +750,20 @@ void RayRenderCOLLADA(CRay * I, int width, int height, /* Create a new XML DOM tree, to which the COLLADA document will be * written */ doc = xmlNewDoc(BAD_CAST XML_VERSION); - if (doc == NULL) { + if (doc == nullptr) { printf("ColladaRender: Error creating the xml document tree (xmlNewDoc).\n"); return; } /* Create a new XmlWriter */ - w = xmlNewTextWriterTree(doc, NULL, 0); - if (w == NULL) { + w = xmlNewTextWriterTree(doc, nullptr, 0); + if (w == nullptr) { printf("ColladaRender: Error creating the xml writer (xmlNewTextWriterTree).\n"); return; } /* Start the XML document */ - rc = xmlTextWriterStartDocument(w, NULL, XML_ENCODING, NULL); + rc = xmlTextWriterStartDocument(w, nullptr, XML_ENCODING, nullptr); if (rc < 0) { printf("ColladaRender: Error at xmlTextWriterStartDocument\n"); return; @@ -970,7 +970,7 @@ void RayRenderCOLLADA(CRay * I, int width, int height, /* color */ const float *bg_color; - bg_color = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)); + bg_color = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)); sprintf(next, "%6.4f %6.4f %6.4f", bg_color[0], bg_color[1], bg_color[2]); UtilConcatVLA(&colors_str, &col_str_cc, next); @@ -1244,7 +1244,7 @@ void RayRenderCOLLADA(CRay * I, int width, int height, const int j_arr[] = {2, 3, 2}; int nCapTri = 0; cCylCap captype[2] = {prim->cap1, prim->cap2}; - CGO *cgocap[2] = {NULL, NULL}; + CGO *cgocap[2] = {NULL, nullptr}; if(prim->type == cPrimSausage) { captype[0] = captype[1] = cCylCapRound; diff --git a/layer1/Character.cpp b/layer1/Character.cpp index cefc6e66f..4d902ca30 100644 --- a/layer1/Character.cpp +++ b/layer1/Character.cpp @@ -126,7 +126,7 @@ unsigned char *CharacterGetPixmapBuffer(PyMOLGlobals * G, int id) CharRec *rec = I->Char + id; return rec->Pixmap.buffer; } - return NULL; + return nullptr; } int CharacterNewFromBitmap(PyMOLGlobals * G, int width, int height, @@ -401,7 +401,7 @@ int CharacterGetGeometry(PyMOLGlobals * G, int id, int CharacterInit(PyMOLGlobals * G) { - CCharacter *I = NULL; + CCharacter *I = nullptr; if((I = (G->Character = pymol::calloc(1)))) { I->MaxAlloc = 5; I->Char = VLACalloc(CharRec, I->MaxAlloc + 1); diff --git a/layer1/Color.cpp b/layer1/Color.cpp index 1c8382fb3..b7fb67697 100644 --- a/layer1/Color.cpp +++ b/layer1/Color.cpp @@ -80,7 +80,7 @@ static void lookup_color(CColor * I, const float *in, float *out, int big_endian void ColorGetBkrdContColor(PyMOLGlobals * G, float *rgb, int invert_flag) { - const float *bkrd = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)); + const float *bkrd = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)); if(!invert_flag) { if((bkrd[0] + bkrd[1] + bkrd[2]) > 0.5F) { @@ -774,7 +774,7 @@ const char *ColorGetName(PyMOLGlobals * G, int index) if (a < I->Ext.size()) { return I->Ext[a].Name; } else - return NULL; + return nullptr; } return (NULL); } @@ -1733,7 +1733,7 @@ int ColorLookupColor(PyMOLGlobals * G, float *color) /*========================================================================*/ int ColorInit(PyMOLGlobals * G) { - CColor *I = NULL; + CColor *I = nullptr; if ((G->Color = new CColor())) { I = G->Color; @@ -1763,13 +1763,13 @@ void ColorUpdateFront(PyMOLGlobals * G, const float *back) } void ColorUpdateFrontFromSettings(PyMOLGlobals * G){ - int bg_gradient = SettingGet_b(G, NULL, NULL, cSetting_bg_gradient); - const char * bg_image_filename = SettingGet_s(G, NULL, NULL, cSetting_bg_image_filename); + int bg_gradient = SettingGet_b(G, nullptr, nullptr, cSetting_bg_gradient); + const char * bg_image_filename = SettingGet_s(G, nullptr, nullptr, cSetting_bg_image_filename); short bg_image = bg_image_filename && bg_image_filename[0]; if (!bg_gradient){ if (!bg_image && !OrthoBackgroundDataIsSet(*G->Ortho)){ - const float *v = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)); + const float *v = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)); ColorUpdateFront(G, v); } else { float v[] = { 0.f, 0.f, 0.f }; @@ -1777,8 +1777,8 @@ void ColorUpdateFrontFromSettings(PyMOLGlobals * G){ } } else { float vv[3]; - const float *v = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb_bottom)); - const float *vb = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb_top)); + const float *v = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb_bottom)); + const float *vb = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb_top)); average3f(v, vb, vv); ColorUpdateFront(G, vv); } diff --git a/layer1/Control.cpp b/layer1/Control.cpp index db865e85d..0dd335360 100644 --- a/layer1/Control.cpp +++ b/layer1/Control.cpp @@ -853,7 +853,7 @@ void CControl::draw(CGO* orthoCGO) /*========================================================================*/ int ControlInit(PyMOLGlobals * G) { - CControl *I = NULL; + CControl *I = nullptr; if((I = (G->Control = new CControl(G)))) { I->active = true; I->TextColor[0] = 1.0; diff --git a/layer1/Extrude.cpp b/layer1/Extrude.cpp index a00201aee..0a13d276a 100644 --- a/layer1/Extrude.cpp +++ b/layer1/Extrude.cpp @@ -56,7 +56,7 @@ CExtrude *ExtrudeCopyPointsNormalsColors(CExtrude * orig) CopyArray(I->sf, orig->sf, float, I->N); /* PUTTY: scale factors */ } else { ExtrudeFree(I); - I = NULL; + I = nullptr; } return (I); } @@ -66,19 +66,19 @@ void ExtrudeInit(PyMOLGlobals * G, CExtrude * I) I->G = G; I->N = 0; - I->p = NULL; - I->n = NULL; - I->c = NULL; + I->p = nullptr; + I->n = nullptr; + I->c = nullptr; I->alpha = nullptr; - I->i = NULL; + I->i = nullptr; - I->sv = NULL; /* shape vertices */ - I->sn = NULL; /* shape normals */ - I->tv = NULL; /* transformed vertices */ - I->tn = NULL; /* transformed normals */ + I->sv = nullptr; /* shape vertices */ + I->sn = nullptr; /* shape normals */ + I->tv = nullptr; /* transformed vertices */ + I->tn = nullptr; /* transformed normals */ I->Ns = 0; /* number of shape points */ - I->sf = NULL; + I->sf = nullptr; } int ExtrudeCircle(CExtrude * I, int n, float size) @@ -131,10 +131,10 @@ int ExtrudeCircle(CExtrude * I, int n, float size) FreeP(I->sn); FreeP(I->tv); FreeP(I->tn); - I->sv = NULL; - I->sn = NULL; - I->tv = NULL; - I->tn = NULL; + I->sv = nullptr; + I->sn = nullptr; + I->tv = nullptr; + I->tn = nullptr; } PRINTFD(I->G, FB_Extrude) @@ -234,10 +234,10 @@ int ExtrudeRectangle(CExtrude * I, float width, float length, int mode) FreeP(I->sn); FreeP(I->tv); FreeP(I->tn); - I->sv = NULL; - I->sn = NULL; - I->tv = NULL; - I->tn = NULL; + I->sv = nullptr; + I->sn = nullptr; + I->tv = nullptr; + I->tn = nullptr; return ok; } @@ -350,10 +350,10 @@ int ExtrudeDumbbell1(CExtrude * I, float width, float length, int mode) FreeP(I->sn); FreeP(I->tv); FreeP(I->tn); - I->sv = NULL; - I->sn = NULL; - I->tv = NULL; - I->tn = NULL; + I->sv = nullptr; + I->sn = nullptr; + I->tv = nullptr; + I->tn = nullptr; } v = I->sv; @@ -455,10 +455,10 @@ int ExtrudeDumbbell2(CExtrude * I, int n, int sign, float length, float size) FreeP(I->sn); FreeP(I->tv); FreeP(I->tn); - I->sv = NULL; - I->sn = NULL; - I->tv = NULL; - I->tn = NULL; + I->sv = nullptr; + I->sn = nullptr; + I->tv = nullptr; + I->tn = nullptr; } I->Ns = n; @@ -817,7 +817,7 @@ void ExtrudeCGOTraceFrame(CExtrude * I, CGO * cgo) * cgo: CGO to add to * index: sampling index in `I` * inv_dir: inverse direction of normal if true - * color: RGB color or NULL to use color from `I` + * color: RGB color or nullptr to use color from `I` */ static void TubeCapFlat(const CExtrude * I, CGO * cgo, int index, bool inv_dir, const float * color) { @@ -859,7 +859,7 @@ void TubeCapFlat(const CExtrude * I, CGO * cgo, int index, bool inv_dir, const f * I: tube instance * cgo: CGO to add to * cap: 0: no caps, 1: flat caps, 2: round caps - * color_override: RGB color or NULL to use color from `I` + * color_override: RGB color or nullptr to use color from `I` * use_spheres: do round caps with spheres instead of triangles * dash: if > 0, skip every segment which is a multiple of `dash` */ @@ -872,7 +872,7 @@ int ExtrudeCGOSurfaceTube(const CExtrude* I, CGO* cgo, cCylCap cap, float *n; float *c; const float *alpha; - float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; + float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = nullptr, *TN = nullptr; int start, stop; int ok = true; PRINTFD(I->G, FB_Extrude) @@ -1239,7 +1239,7 @@ int ExtrudeCGOSurfaceVariableTube(const CExtrude* I, CGO* cgo, cCylCap cap) float *n; float *c; const float *alpha; - float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL, *AN = NULL, *an; + float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = nullptr, *TN = nullptr, *AN = nullptr, *an; float v0[3]; float *sf; /* PUTTY: scale factor from ExtrudeMakeSausLUT() */ int ok = true; @@ -1513,7 +1513,7 @@ int ExtrudeCGOSurfacePolygon(const CExtrude * I, CGO * cgo, cCylCap cap, const f float *n; float *c; const float *alpha; - float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; + float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = nullptr, *TN = nullptr; float v0[3]; int ok = true; @@ -1709,7 +1709,7 @@ int ExtrudeCGOSurfacePolygonTaper(const CExtrude * I, CGO * cgo, int sampling, float *n; float *c; const float *alpha; - float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; + float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = nullptr, *TN = nullptr; float s0[3]; float f; int subN; @@ -1851,7 +1851,7 @@ int ExtrudeCGOSurfaceStrand(const CExtrude * I, CGO * cgo, int sampling, const f float *n; float *c; const float *alpha; - float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = NULL, *TN = NULL; + float *sv, *sn, *tv, *tn, *tv1, *tn1, *TV = nullptr, *TN = nullptr; float v0[3], n0[3], s0[3], z[3] = { 1.0, 0.0, 1.0 }; int subN; int ok = true; diff --git a/layer1/FontGLUT.cpp b/layer1/FontGLUT.cpp index 4e6aba73a..1528576ab 100644 --- a/layer1/FontGLUT.cpp +++ b/layer1/FontGLUT.cpp @@ -131,7 +131,7 @@ const char* CFontGLUT::RenderOpenGL(const RenderInfo* info, const char* st, if(st && (*st)) { - float v_scale = SceneGetScreenVertexScale(G, NULL); + float v_scale = SceneGetScreenVertexScale(G, nullptr); first = font_info->first; last = first + font_info->num_chars; @@ -332,7 +332,7 @@ const char* CFontGLUT::RenderRay(CRay* ray, const char* st, float size, sampling = ray->Sampling; if(st && (*st)) { - float v_scale = SceneGetScreenVertexScale(G, NULL); + float v_scale = SceneGetScreenVertexScale(G, nullptr); if(rpos) { float loc[3]; diff --git a/layer1/FontType.cpp b/layer1/FontType.cpp index e1ee26b7e..97b025392 100644 --- a/layer1/FontType.cpp +++ b/layer1/FontType.cpp @@ -91,11 +91,11 @@ static const char* FontTypeRenderOpenGLImpl(const RenderInfo* info, CFontType* I int linenum = 0; short cont = 0; float descender = TypeFaceGetDescender(I->TypeFace) / 2.f; - float v_scale = SceneGetScreenVertexScale(G, NULL); + float v_scale = SceneGetScreenVertexScale(G, nullptr); copy2f(TextGetLabelBuffer(G), text_buffer); sampling = info->sampling; if(st && (*st)) { - float *line_widths = NULL; + float *line_widths = nullptr; float screenWorldOffset[3] = { 0.0F, 0.0F, 0.0F }; float tot_height; if (nlines>1){ @@ -335,11 +335,11 @@ const char* CFontType::RenderRay(CRay* ray, const char* st, float size, int nlines = countchrs(st, '\n') + 1; int linenum = 0; float descender = TypeFaceGetDescender(I->TypeFace); - float v_scale = SceneGetScreenVertexScale(G, NULL); + float v_scale = SceneGetScreenVertexScale(G, nullptr); copy2f(TextGetLabelBuffer(G), text_buffer); if(st && (*st)) { float origpos[3]; - float *line_widths = NULL; + float *line_widths = nullptr; float tot_height; if (nlines>1){ line_widths = pymol::calloc(nlines); diff --git a/layer1/Movie.cpp b/layer1/Movie.cpp index 0c6fb649e..49d9248dd 100644 --- a/layer1/Movie.cpp +++ b/layer1/Movie.cpp @@ -66,7 +66,7 @@ void MovieViewReinterpolate(PyMOLGlobals *G) MovieView(G, 3, -1, -1, power, bias, 1, /* note simple always = 1 for camera motion...*/ linear, SettingGetGlobal_b(G,cSetting_movie_loop) ? 1 : 0 , - hand, 5, 1, NULL, 0.5, -1, 1); + hand, 5, 1, nullptr, 0.5, -1, 1); } int MovieXtoFrame(PyMOLGlobals *G, BlockRect *rect, int frames, int x, int nearest) @@ -213,7 +213,7 @@ void MovieCopyPrepare(PyMOLGlobals * G, int *width, int *height, int *length) SettingSetGlobal_i(G, cSetting_overlay, 5); nFrame = I->NFrame; if(!nFrame) { - nFrame = SceneGetNFrame(G, NULL); + nFrame = SceneGetNFrame(G, nullptr); } start = 0; stop = nFrame; @@ -274,7 +274,7 @@ int MovieCopyFrame(PyMOLGlobals * G, int frame, int width, int height, int rowby int nFrame; nFrame = I->NFrame; if(!nFrame) { - nFrame = SceneGetNFrame(G, NULL); + nFrame = SceneGetNFrame(G, nullptr); } if((frame < nFrame) && (ptr)) { @@ -333,7 +333,7 @@ int MoviePurgeFrame(PyMOLGlobals * G, int frame) int i; nFrame = I->NFrame; if(!nFrame) { - nFrame = SceneGetNFrame(G, NULL); + nFrame = SceneGetNFrame(G, nullptr); } if(!I->CacheSave) { if(frame < nFrame) { @@ -411,7 +411,7 @@ static int MovieCmdFromPyList(PyMOLGlobals * G, PyObject * list, int *warning) int warn = false; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); @@ -463,7 +463,7 @@ int MovieFromPyList(PyMOLGlobals * G, PyObject * list, int *warning) if(ok && (ll > 6)) { PyObject *tmp; VLAFreeP(I->ViewElem); - I->ViewElem = NULL; + I->ViewElem = nullptr; tmp = PyList_GetItem(list, 6); if(tmp && !(tmp == Py_None)) ok = ViewElemVLAFromPyList(G, tmp, &I->ViewElem, I->NFrame); @@ -483,7 +483,7 @@ static PyObject *MovieCmdAsPyList(PyMOLGlobals * G) { CMovie *I = G->Movie; - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->NFrame); @@ -499,7 +499,7 @@ static PyObject *MovieCmdAsPyList(PyMOLGlobals * G) PyObject *MovieAsPyList(PyMOLGlobals * G) { CMovie *I = G->Movie; - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(7); PyList_SetItem(result, 0, PyInt_FromLong(I->NFrame)); @@ -561,7 +561,7 @@ void MoviePlay(PyMOLGlobals * G, int cmd) if(I->Playing && !SettingGetGlobal_b(G, cSetting_movie_loop)) { /* if not looping, and at end of movie, then automatically rewind and force execution of the first movie command */ - if((SettingGetGlobal_i(G, cSetting_frame)) == (SceneGetNFrame(G, NULL))) { + if((SettingGetGlobal_i(G, cSetting_frame)) == (SceneGetNFrame(G, nullptr))) { SceneSetFrame(G, 7, 0); } } @@ -573,7 +573,7 @@ void MoviePlay(PyMOLGlobals * G, int cmd) if(!SettingGetGlobal_b(G, cSetting_movie_loop)) { /* if not looping, and at end of movie, then automatically rewind and force execution of the first movie command */ - if((SettingGetGlobal_i(G, cSetting_frame)) == (SceneGetNFrame(G, NULL))) { + if((SettingGetGlobal_i(G, cSetting_frame)) == (SceneGetNFrame(G, nullptr))) { SceneSetFrame(G, 7, 0); } } @@ -635,7 +635,7 @@ static void MovieModalPNG(PyMOLGlobals * G, CMovie * I, CMovieModal * M) OrthoBusyPrime(G); M->nFrame = I->NFrame; if(!M->nFrame) { - M->nFrame = SceneGetNFrame(G, NULL); + M->nFrame = SceneGetNFrame(G, nullptr); if(M->nFrame < 1) { M->nFrame = 1; } @@ -1131,7 +1131,7 @@ int MovieView(PyMOLGlobals * G, int action, int first, first = 0; if(last < 0) { - last = SceneGetNFrame(G, NULL) - 1; + last = SceneGetNFrame(G, nullptr) - 1; } if(last >= I->NFrame) { last = I->NFrame - 1; @@ -1167,7 +1167,7 @@ int MovieView(PyMOLGlobals * G, int action, int first, " MovieView: Setting frame %d.\n", frame + 1 ENDFB(G); } if(scene_name && (!scene_name[0])) - scene_name = NULL; + scene_name = nullptr; SceneToViewElem(G, I->ViewElem + frame, scene_name); if(state>=0) { I->ViewElem[frame].state = state; @@ -1211,7 +1211,7 @@ int MovieView(PyMOLGlobals * G, int action, int first, case 3: if(I->ViewElem) { int view_found = false; - CViewElem *first_view = NULL, *last_view = NULL; + CViewElem *first_view = nullptr, *last_view = nullptr; if(first < 0) first = 0; @@ -1313,7 +1313,7 @@ int MovieView(PyMOLGlobals * G, int action, int first, power, bias, simple, linear, hand, scene_cut); } first_view = last_view; - last_view = NULL; + last_view = nullptr; } } } @@ -1351,7 +1351,7 @@ int MovieView(PyMOLGlobals * G, int action, int first, if(first < 0) first = 0; if(last < 0) { - last = SceneGetNFrame(G, NULL) - 1; + last = SceneGetNFrame(G, nullptr) - 1; } for(frame = first; frame <= last; frame++) { if((frame >= 0) && (frame < I->NFrame)) { diff --git a/layer1/Ortho.cpp b/layer1/Ortho.cpp index 4adbead98..8e0b55950 100644 --- a/layer1/Ortho.cpp +++ b/layer1/Ortho.cpp @@ -480,7 +480,7 @@ void OrthoClear(PyMOLGlobals * G) COrtho *I = G->Ortho; for(a = 0; a <= OrthoSaveLines; a++) I->Line[a][0] = 0; - OrthoNewLine(G, NULL, true); + OrthoNewLine(G, nullptr, true); OrthoRestorePrompt(G); OrthoInvalidateDoDraw(G); OrthoDirty(G); @@ -662,7 +662,7 @@ void OrthoBusyDraw(PyMOLGlobals * G, int force) if(*c) { TextSetColor(G, white); TextSetPos2i(G, cBusyMargin, y - (cBusySpacing / 2)); - TextDrawStr(G, c, NULL); + TextDrawStr(G, c, nullptr); y -= cBusySpacing; } @@ -742,7 +742,7 @@ void OrthoRestorePrompt(PyMOLGlobals * G) if(!I->InputFlag) { if(I->Saved[0]) { if(I->CurChar) { - OrthoNewLine(G, NULL, true); + OrthoNewLine(G, nullptr, true); } curLine = I->CurLine & OrthoSaveLines; strcpy(I->Line[curLine], I->Saved); @@ -1056,7 +1056,7 @@ void OrthoParseCurrentLine(PyMOLGlobals * G) I->History[I->HistoryLine][0] = 0; I->HistoryView = I->HistoryLine; - OrthoNewLine(G, NULL, true); + OrthoNewLine(G, nullptr, true); if(WordMatch(G, buffer, "quit", true) == 0) /* don't log quit */ PLog(G, buffer, cPLog_pml); OrthoDirty(G); /* this will force a redraw, if necessary */ @@ -1100,7 +1100,7 @@ void OrthoAddOutput(PyMOLGlobals * G, const char *str) if(cc > wrap) { *q = 0; I->CurChar = cc; - OrthoNewLine(G, NULL, true); + OrthoNewLine(G, nullptr, true); cc = 0; q = I->Line[I->CurLine & OrthoSaveLines]; curLine = I->CurLine & OrthoSaveLines; @@ -1109,7 +1109,7 @@ void OrthoAddOutput(PyMOLGlobals * G, const char *str) if(cc >= OrthoLineLength - 6) { /* fail safe */ *q = 0; I->CurChar = cc; - OrthoNewLine(G, NULL, false); + OrthoNewLine(G, nullptr, false); cc = 0; q = I->Line[I->CurLine & OrthoSaveLines]; curLine = I->CurLine & OrthoSaveLines; @@ -1118,7 +1118,7 @@ void OrthoAddOutput(PyMOLGlobals * G, const char *str) } else { *q = 0; I->CurChar = cc; - OrthoNewLine(G, NULL, true); + OrthoNewLine(G, nullptr, true); q = I->Line[I->CurLine & OrthoSaveLines]; curLine = I->CurLine & OrthoSaveLines; p++; @@ -1228,7 +1228,7 @@ void OrthoDoViewportWhenReleased(PyMOLGlobals *G) void OrthoUngrab(PyMOLGlobals * G) { COrtho *I = G->Ortho; - I->GrabbedBy = NULL; + I->GrabbedBy = nullptr; } @@ -1244,7 +1244,7 @@ void OrthoDetach(PyMOLGlobals * G, Block * block) { COrtho *I = G->Ortho; if(I->GrabbedBy == block) - I->GrabbedBy = NULL; + I->GrabbedBy = nullptr; auto iter = std::find(I->Blocks.begin(), I->Blocks.end(), block); if(iter != I->Blocks.end()){ I->Blocks.erase(iter); @@ -1428,7 +1428,7 @@ void bg_grad(PyMOLGlobals * G) { if (!(bg_gradient != BgGradient::None || bg_image_filename || I->bgData) || !G->ShaderMgr->ShadersPresent()) { - const float *bg_rgb = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)); + const float *bg_rgb = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)); SceneGLClearColor(bg_rgb[0], bg_rgb[1], bg_rgb[2], 1.0); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); return; @@ -1475,14 +1475,14 @@ void bg_grad(PyMOLGlobals * G) { } glDisable(GL_DEPTH_TEST); - CGORender(I->bgCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(I->bgCGO, nullptr, nullptr, nullptr, nullptr, nullptr); glEnable(GL_DEPTH_TEST); } void OrthoDoDraw(PyMOLGlobals * G, OrthoRenderMode render_mode) { COrtho *I = G->Ortho; - CGO *orthoCGO = NULL; + CGO *orthoCGO = nullptr; int x, y; int l, lcount; char *str; @@ -1513,13 +1513,13 @@ void OrthoDoDraw(PyMOLGlobals * G, OrthoRenderMode render_mode) I->HaveSeqViewer = false; } - if(SettingGet_i(G, NULL, NULL, cSetting_internal_prompt)) + if(SettingGet_i(G, nullptr, nullptr, cSetting_internal_prompt)) skip_prompt = 0; else skip_prompt = 1; - double_pump = SettingGet_i(G, NULL, NULL, cSetting_stereo_double_pump_mono); - bg_color = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)); + double_pump = SettingGet_i(G, nullptr, nullptr, cSetting_stereo_double_pump_mono); + bg_color = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)); I->OverlayColor[0] = 1.0F - bg_color[0]; I->OverlayColor[1] = 1.0F - bg_color[1]; @@ -1995,13 +1995,13 @@ void OrthoDoDraw(PyMOLGlobals * G, OrthoRenderMode render_mode) void OrthoRenderCGO(PyMOLGlobals * G){ COrtho *I = G->Ortho; if (I->orthoCGO) { - SceneDrawImageOverlay(G, 0, NULL); + SceneDrawImageOverlay(G, 0, nullptr); glDisable(GL_DEPTH_TEST); glEnable(GL_BLEND); if (I->orthoCGO) - CGORender(I->orthoCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(I->orthoCGO, nullptr, nullptr, nullptr, nullptr, nullptr); if (I->orthoFastCGO) - CGORender(I->orthoFastCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(I->orthoFastCGO, nullptr, nullptr, nullptr, nullptr, nullptr); G->ShaderMgr->Disable_Current_Shader(); glEnable(GL_DEPTH_TEST); } @@ -2147,7 +2147,7 @@ static void OrthoLayoutPanel(PyMOLGlobals * G, int m_top, int m_left, int m_bottom, int m_right) { COrtho *I = G->Ortho; - Block *block = NULL; + Block *block = nullptr; int controlHeight = DIP2PIXEL(20); int butModeHeight = ButModeGetHeight(G); @@ -2226,7 +2226,7 @@ void OrthoReshape(PyMOLGlobals * G, int width, int height, int force) if(!G->HaveGUI && width < 0) return; - Block *block = NULL; + Block *block = nullptr; int sceneBottom, sceneRight = 0; int textBottom = 0; int internal_gui_width; @@ -2327,7 +2327,7 @@ void OrthoReshape(PyMOLGlobals * G, int width, int height, int force) block = SceneGetBlock(G); block->setMargin(sceneTop, 0, sceneBottom, sceneRight); - block = NULL; + block = nullptr; for(auto block : I->Blocks){ block->reshape(width, height); } @@ -2374,7 +2374,7 @@ ClickSide OrthoGetWrapClickSide(PyMOLGlobals* G) int OrthoButton(PyMOLGlobals * G, int button, int state, int x, int y, int mod) { COrtho *I = G->Ortho; - Block *block = NULL; + Block *block = nullptr; int handled = 0; PRINTFB(G, FB_Ortho, FB_Blather) @@ -2393,7 +2393,7 @@ int OrthoButton(PyMOLGlobals * G, int button, int state, int x, int y, int mod) if(I->WrapXFlag) { if(state == P_GLUT_DOWN) { - x = get_wrap_x(x, NULL, G->Option->winX, &I->WrapClickSide); + x = get_wrap_x(x, nullptr, G->Option->winX, &I->WrapClickSide); } else { x = get_wrap_x(x, &I->LastX, G->Option->winX, &I->WrapClickSide); } @@ -2428,12 +2428,12 @@ int OrthoButton(PyMOLGlobals * G, int button, int state, int x, int y, int mod) if(I->GrabbedBy) { block = I->GrabbedBy; handled = block->release(button, x, y, mod); - I->ClickedIn = NULL; + I->ClickedIn = nullptr; } if(I->ClickedIn) { block = I->ClickedIn; handled = block->release(button, x, y, mod); - I->ClickedIn = NULL; + I->ClickedIn = nullptr; } I->ActiveButton = -1; } @@ -2457,11 +2457,11 @@ int OrthoDrag(PyMOLGlobals * G, int x, int y, int mod) { COrtho *I = G->Ortho; - Block *block = NULL; + Block *block = nullptr; int handled = 0; if(I->WrapXFlag) { - x = get_wrap_x(x, &I->LastX, G->Option->winX, NULL); + x = get_wrap_x(x, &I->LastX, G->Option->winX, nullptr); } I->LastX = x; @@ -2555,7 +2555,7 @@ void OrthoSplash(PyMOLGlobals * G) /*========================================================================*/ int OrthoInit(PyMOLGlobals * G, int showSplash) { - COrtho *I = NULL; + COrtho *I = nullptr; if((I = (G->Ortho = new COrtho()))) { @@ -2572,8 +2572,8 @@ int OrthoInit(PyMOLGlobals * G, int showSplash) I->WizardTextColor[1] = 1.0F; I->WizardTextColor[2] = 0.2F; - I->GrabbedBy = NULL; - I->ClickedIn = NULL; + I->GrabbedBy = nullptr; + I->ClickedIn = nullptr; I->DrawText = 1; I->HaveSeqViewer = false; I->TextColor[0] = 0.83F; @@ -2591,7 +2591,7 @@ int OrthoInit(PyMOLGlobals * G, int showSplash) I->HistoryLine = 0; I->HistoryView = 0; I->Line[I->CurLine & OrthoSaveLines][I->CurChar] = 0; - I->WizardPromptVLA = NULL; + I->WizardPromptVLA = nullptr; I->SplashFlag = false; I->ShowLines = 1; I->Saved[0] = 0; @@ -2601,10 +2601,10 @@ int OrthoInit(PyMOLGlobals * G, int showSplash) I->DrawTime = 0.0; I->bg_texture_id = 0; I->bg_texture_needs_update = 0; - I->bgCGO = NULL; + I->bgCGO = nullptr; I->bgData = nullptr; - I->orthoCGO = NULL; - I->orthoFastCGO = NULL; + I->orthoCGO = nullptr; + I->orthoFastCGO = nullptr; if(showSplash) { OrthoSplash(G); @@ -2646,7 +2646,7 @@ void OrthoFree(PyMOLGlobals * G) VLAFreeP(I->WizardPromptVLA); PopFree(G); { - I->cmdActiveQueue = NULL; + I->cmdActiveQueue = nullptr; } I->bgData = nullptr; @@ -2814,7 +2814,7 @@ void OrthoSetBackgroundImage(PyMOLGlobals * G, const char *image_data, int width short should_update = 0; if (I->bgData){ FreeP(I->bgData); - I->bgData = NULL; + I->bgData = nullptr; I->bgWidth = 0; I->bgHeight = 0; should_update = 1; diff --git a/layer1/P.cpp b/layer1/P.cpp index e78f4c718..e81196efa 100644 --- a/layer1/P.cpp +++ b/layer1/P.cpp @@ -70,7 +70,7 @@ the initialization functions for these libraries on startup. #include /** - * Use with functions which return a PyObject - if they return NULL, then an + * Use with functions which return a PyObject - if they return nullptr, then an * unexpected exception has occured. */ #define ASSERT_PYOBJECT_NOT_NULL(obj, return_value) \ @@ -341,15 +341,15 @@ int PLabelAtomAlt(PyMOLGlobals * G, AtomInfoType * at, const char *model, const /* local to this C code module */ -static PyObject *P_pymol = NULL; -static PyObject *P_pymol_dict = NULL; /* must be refomed into globals and instance properties */ -static PyObject *P_cmd = NULL; +static PyObject *P_pymol = nullptr; +static PyObject *P_pymol_dict = nullptr; /* must be refomed into globals and instance properties */ +static PyObject *P_cmd = nullptr; -static PyObject *P_povray = NULL; -static PyObject *P_traceback = NULL; -static PyObject *P_parser = NULL; +static PyObject *P_povray = nullptr; +static PyObject *P_traceback = nullptr; +static PyObject *P_parser = nullptr; -static PyObject *P_vfont = NULL; +static PyObject *P_vfont = nullptr; /* module import helper */ @@ -375,11 +375,11 @@ PyObject * PGetAttrOrFatal(PyObject * o, const char * name) { /* used elsewhere */ -PyObject *P_menu = NULL; /* menu definitions are currently global */ -PyObject *P_xray = NULL; /* okay as global */ -PyObject *P_chempy = NULL; /* okay as global */ -PyObject *P_models = NULL; /* okay as global */ -PyObject *P_setting = NULL; /* okay as global -- just used for names */ +PyObject *P_menu = nullptr; /* menu definitions are currently global */ +PyObject *P_xray = nullptr; /* okay as global */ +PyObject *P_chempy = nullptr; /* okay as global */ +PyObject *P_models = nullptr; /* okay as global */ +PyObject *P_setting = nullptr; /* okay as global -- just used for names */ PyObject *P_CmdException = nullptr; PyObject *P_QuietException = nullptr; PyObject *P_IncentiveOnlyException = nullptr; @@ -452,16 +452,16 @@ static PyObject *SettingWrapperObjectSubScript(PyObject *obj, PyObject *key){ auto& wobj = reinterpret_cast(obj)->wobj; int setting_id; - PyObject *ret = NULL; + PyObject *ret = nullptr; if (!check_wrapper_scope(wobj)) { - return NULL; + return nullptr; } auto G = wobj->G; if ((setting_id = get_and_check_setting_index(G, key)) == -1) { - return NULL; + return nullptr; } if (wobj->idx >= 0){ @@ -476,7 +476,7 @@ PyObject *SettingWrapperObjectSubScript(PyObject *obj, PyObject *key){ if (!ret) { // object-state, object, or global ret = SettingGetPyObject(G, - wobj->cs ? wobj->cs->Setting.get() : NULL, + wobj->cs ? wobj->cs->Setting.get() : nullptr, wobj->obj->Setting.get(), setting_id); } } @@ -548,7 +548,7 @@ static PyObject* SettingWrapperObjectIter(PyObject *self) auto& wobj = reinterpret_cast(self)->wobj; if (!check_wrapper_scope(wobj)) { - return NULL; + return nullptr; } int unique_id = wobj->atomInfo->unique_id; @@ -663,7 +663,7 @@ PyObject * WrapperObjectSubScript(PyObject *obj, PyObject *key){ auto wobj = static_cast(obj); if (!check_wrapper_scope(wobj)) - return NULL; + return nullptr; PyMOLGlobals* G = wobj->G; PyObject* ret = nullptr; @@ -679,7 +679,7 @@ PyObject * WrapperObjectSubScript(PyObject *obj, PyObject *key){ if (ObjectMoleculeUpdateMMStereoInfoForState(G, wobj->obj, wobj->state - 1) < 0) { PyErr_SetString(P_CmdException, "please install rdkit or set SCHRODINGER variable"); - return NULL; + return nullptr; } break; case ATOM_PROP_TEXT_TYPE: @@ -994,8 +994,8 @@ int WrapperObjectAssignSubScript(PyObject *obj, PyObject *key, PyObject *val){ /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ #ifdef WIN32 -static PyObject *P_time = NULL; -static PyObject *P_sleep = NULL; +static PyObject *P_time = nullptr; +static PyObject *P_sleep = nullptr; #endif /* END PROPRIETARY CODE SEGMENT */ @@ -1075,7 +1075,7 @@ void PCatchInit(void); /* PyObject *GetBondsDict(PyMOLGlobals *G) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyObject_GetAttrString(P_chempy,"bonds"); if(!result) ErrMessage(G,"PyMOL","can't find 'chempy.bonds.bonds'"); return(result); @@ -1086,7 +1086,7 @@ PyObject *PGetFontDict(PyMOLGlobals * G, float size, int face, int style) { /* assumes we have a valid interpreter lock */ assert(PyGILState_Check()); - PyObject *result = NULL; + PyObject *result = nullptr; if(!P_vfont) { P_vfont = PyImport_ImportModule("pymol.vfont"); @@ -1300,15 +1300,15 @@ ov_status PCacheGet(PyMOLGlobals * G, ov_status status = OV_STATUS_NO; if(G->P_inst->cache) { - PyObject *entry = NULL; - PyObject *output = NULL; + PyObject *entry = nullptr; + PyObject *output = nullptr; if(OV_OK(CacheCreateEntry(&entry, input))) { output = PYOBJECT_CALLMETHOD(G->P_inst->cmd, "_cache_get", "OOO", entry, Py_None, G->P_inst->cmd); if(output == Py_None) { Py_DECREF(output); - output = NULL; + output = nullptr; } else { status = OV_STATUS_YES; } @@ -1337,7 +1337,7 @@ void PSleepWhileBusy(PyMOLGlobals * G, int usec) " PSleep-DEBUG: napping.\n" ENDFD; tv.tv_sec = 0; tv.tv_usec = usec; - select(0, NULL, NULL, NULL, &tv); + select(0, nullptr, nullptr, nullptr, &tv); PRINTFD(G, FB_Threads) " PSleep-DEBUG: nap over.\n" ENDFD; #else @@ -1359,7 +1359,7 @@ void PSleepUnlocked(PyMOLGlobals * G, int usec) " PSleep-DEBUG: napping.\n" ENDFD; tv.tv_sec = 0; tv.tv_usec = usec; - select(0, NULL, NULL, NULL, &tv); + select(0, nullptr, nullptr, nullptr, &tv); PRINTFD(G, FB_Threads) " PSleep-DEBUG: nap over.\n" ENDFD; #else @@ -1382,7 +1382,7 @@ void PSleep(PyMOLGlobals * G, int usec) " PSleep-DEBUG: napping.\n" ENDFD; tv.tv_sec = 0; tv.tv_usec = usec; - select(0, NULL, NULL, NULL, &tv); + select(0, nullptr, nullptr, nullptr, &tv); PRINTFD(G, FB_Threads) " PSleep-DEBUG: nap over.\n" ENDFD; PLockAPIAsGlut(G, true); @@ -1423,10 +1423,10 @@ static WrapperObject * WrapperObjectNew() { auto wobj = static_cast( PyType_GenericNew(&Wrapper_Type, Py_None, Py_None)); - wobj->dict = NULL; - wobj->settingWrapperObject = NULL; + wobj->dict = nullptr; + wobj->settingWrapperObject = nullptr; #ifdef _PYMOL_IP_PROPERTIES - wobj->propertyWrapperObject = NULL; + wobj->propertyWrapperObject = nullptr; #endif return wobj; } @@ -1655,7 +1655,7 @@ int PLockAPIAsGlut(PyMOLGlobals * G, int block_if_busy) PUnblock(G); tv.tv_sec = 0; tv.tv_usec = 50000; - select(0, NULL, NULL, NULL, &tv); + select(0, nullptr, nullptr, nullptr, &tv); PBlock(G); } #else @@ -1904,7 +1904,7 @@ void PInit(PyMOLGlobals * G, int global_instance) G->P_inst->exec = PGetAttrOrFatal(P_pymol, "exec_str"); if(global_instance) { - PCatch_install(NULL, NULL); + PCatch_install(NULL, nullptr); } P_traceback = PImportModuleOrFatal("traceback"); @@ -1999,7 +1999,7 @@ void PInit(PyMOLGlobals * G, int global_instance) Wrapper_Type.tp_basicsize = sizeof(WrapperObject); Wrapper_Type.tp_dealloc = &WrapperObjectDealloc; Wrapper_Type.tp_flags = Py_TPFLAGS_DEFAULT; - wrapperMappingMethods.mp_length = NULL; + wrapperMappingMethods.mp_length = nullptr; wrapperMappingMethods.mp_subscript = &WrapperObjectSubScript; wrapperMappingMethods.mp_ass_subscript = &WrapperObjectAssignSubScript; Wrapper_Type.tp_as_mapping = &wrapperMappingMethods; @@ -2008,7 +2008,7 @@ void PInit(PyMOLGlobals * G, int global_instance) settingWrapper_Type.tp_basicsize = sizeof(SettingPropertyWrapperObject); settingWrapper_Type.tp_flags = Py_TPFLAGS_DEFAULT; settingWrapper_Type.tp_iter = &SettingWrapperObjectIter; - settingMappingMethods.mp_length = NULL; + settingMappingMethods.mp_length = nullptr; settingMappingMethods.mp_subscript = &SettingWrapperObjectSubScript; settingMappingMethods.mp_ass_subscript = &SettingWrapperObjectAssignSubScript; settingWrapper_Type.tp_as_mapping = &settingMappingMethods; @@ -2633,7 +2633,7 @@ static PyMethodDef PCatch_methods[] = { {"flush", PCatchFlush, METH_VARARGS}, {"isatty", PCatchIsAtty, METH_VARARGS}, // called by pip.main(["install", "..."]) {"_install", PCatch_install, METH_VARARGS}, - {NULL, NULL} /* sentinel */ + {NULL, nullptr} /* sentinel */ }; void PCatchInit(void) @@ -2641,7 +2641,7 @@ void PCatchInit(void) assert(PyGILState_Check()); static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, - "pcatch", NULL, -1, PCatch_methods }; + "pcatch", nullptr, -1, PCatch_methods }; PyObject * pcatch = PyModule_Create(&moduledef); if (pcatch) { PyDict_SetItemString(PyImport_GetModuleDict(), "pcatch", pcatch); diff --git a/layer1/P.h b/layer1/P.h index 9916efbaf..4a2338926 100644 --- a/layer1/P.h +++ b/layer1/P.h @@ -180,7 +180,7 @@ PyObject *PXIncRef(PyObject * obj); /** * Like `Py_INCREF` but returns the input argument for convenience. - * Does not accept NULL, unlike `PXIncRef`. + * Does not accept nullptr, unlike `PXIncRef`. */ inline PyObject* PIncRef(PyObject* obj) { diff --git a/layer1/PConv.cpp b/layer1/PConv.cpp index 9b4d6dca6..76173f257 100644 --- a/layer1/PConv.cpp +++ b/layer1/PConv.cpp @@ -37,7 +37,7 @@ Z* ------------------------------------------------------------------- */ PyObject *PConvPickleLoads(PyObject * str) { - PyObject *picklemod = NULL, *obj = NULL; + PyObject *picklemod = nullptr, *obj = nullptr; ok_assert(1, picklemod = PyImport_ImportModule(pickle_mod_name)); obj = PYOBJECT_CALLMETHOD(picklemod, "loads", "O", str); ok_except1: @@ -50,7 +50,7 @@ PyObject *PConvPickleLoads(PyObject * str) */ PyObject *PConvPickleDumps(PyObject * obj) { - PyObject *picklemod = NULL, *str = NULL; + PyObject *picklemod = nullptr, *str = nullptr; ok_assert(1, picklemod = PyImport_ImportModule(pickle_mod_name)); str = PYOBJECT_CALLMETHOD(picklemod, "dumps", "Oi", obj, 1); ok_except1: @@ -62,7 +62,7 @@ PyObject *PConvAutoNone(PyObject * result) { /* automatically own Py_None */ if(result == Py_None) Py_INCREF(result); - else if(result == NULL) { + else if(result == nullptr) { result = Py_None; Py_INCREF(result); } @@ -523,7 +523,7 @@ int PConvPyListToFloatArrayImpl(PyObject * obj, float **f, bool as_vla) int ok = true; float *ff; if(!obj) { - *f = NULL; + *f = nullptr; ok = false; } else if (PyBytes_Check(obj)){ // binary_dump @@ -539,7 +539,7 @@ int PConvPyListToFloatArrayImpl(PyObject * obj, float **f, bool as_vla) auto strval = PyBytes_AsSomeString(obj); memcpy(*f, strval.data(), slen); } else if(!PyList_Check(obj)) { - *f = NULL; + *f = nullptr; ok = false; } else { l = (int) PyList_Size(obj); @@ -568,13 +568,13 @@ int PConvPyListToFloatVLANoneOkay(PyObject * obj, float **f) float *ff; int ok = true; if(!obj) { - *f = NULL; + *f = nullptr; ok = false; } else if(obj == Py_None) { - *f = NULL; + *f = nullptr; ok = true; } else if(!PyList_Check(obj)) { - *f = NULL; + *f = nullptr; ok = false; } else { l = PyList_Size(obj); @@ -599,10 +599,10 @@ int PConvPyList3ToFloatVLA(PyObject * obj, float **f) PyObject *triple; int ok = true; if(!obj) { - *f = NULL; + *f = nullptr; ok = false; } else if(!PyList_Check(obj)) { - *f = NULL; + *f = nullptr; ok = false; } else { l = PyList_Size(obj); @@ -636,10 +636,10 @@ int PConvPyListToDoubleArray(PyObject * obj, double **f) double *ff; int ok = true; if(!obj) { - *f = NULL; + *f = nullptr; l = 0; } else if(!PyList_Check(obj)) { - *f = NULL; + *f = nullptr; ok = false; } else { l = PyList_Size(obj); @@ -661,7 +661,7 @@ int PConvPyListToIntArrayImpl(PyObject * obj, int **f, bool as_vla) int *ff; int ok = true; if(!obj) { - *f = NULL; + *f = nullptr; ok = false; } else if (PyBytes_Check(obj)){ // binary_dump @@ -677,7 +677,7 @@ int PConvPyListToIntArrayImpl(PyObject * obj, int **f, bool as_vla) auto strval = PyBytes_AsSomeString(obj); memcpy(*f, strval.data(), slen); } else if(!PyList_Check(obj)) { - *f = NULL; + *f = nullptr; ok = false; } else { l = PyList_Size(obj); @@ -703,9 +703,9 @@ ov_status PConvPyTupleToIntVLA(int **result, PyObject * tuple) { ov_status status = OV_STATUS_FAILURE; if(!(tuple && PyTuple_Check(tuple))) { - *result = NULL; + *result = nullptr; } else { - int *vla = NULL; + int *vla = nullptr; ov_size size = PyTuple_Size(tuple); vla = VLAlloc(int, size); if(vla) { @@ -724,9 +724,9 @@ ov_status PConvPyTupleToFloatVLA(float **result, PyObject * tuple) { ov_status status = OV_STATUS_FAILURE; if(!(tuple && PyTuple_Check(tuple))) { - *result = NULL; + *result = nullptr; } else { - float *vla = NULL; + float *vla = nullptr; ov_size size = PyTuple_Size(tuple); vla = VLAlloc(float, size); if(vla) { @@ -962,7 +962,7 @@ PyObject *PConvFloatArrayToPyList(const float *f, int l, bool dump_binary) PyObject *PConvFloatArrayToPyListNullOkay(const float *f, int l) { int a; - PyObject *result = NULL; + PyObject *result = nullptr; if(f) { result = PyList_New(l); for(a = 0; a < l; a++) @@ -983,7 +983,7 @@ PyObject *PConvDoubleArrayToPyList(const double *f, int l) PyObject *PConvFloatVLAToPyList(const float *f) { int a, l; - PyObject *result = NULL; + PyObject *result = nullptr; l = VLAGetSize(f); result = PyList_New(l); for(a = 0; a < l; a++) { @@ -994,7 +994,7 @@ PyObject *PConvFloatVLAToPyList(const float *f) PyObject *PConvFloatVLAToPyTuple(float *vla) { - PyObject *result = NULL; + PyObject *result = nullptr; if(vla) { ov_size size = VLAGetSize(vla); result = PyTuple_New(size); @@ -1011,7 +1011,7 @@ PyObject *PConvFloatVLAToPyTuple(float *vla) PyObject *PConvIntVLAToPyList(const int *f) { int a, l; - PyObject *result = NULL; + PyObject *result = nullptr; l = VLAGetSize(f); result = PyList_New(l); for(a = 0; a < l; a++) @@ -1021,7 +1021,7 @@ PyObject *PConvIntVLAToPyList(const int *f) PyObject *PConvIntVLAToPyTuple(int *vla) { - PyObject *result = NULL; + PyObject *result = nullptr; if(vla) { ov_size size = VLAGetSize(vla); result = PyTuple_New(size); @@ -1103,7 +1103,7 @@ PyObject *PConvStringVLAToPyList(const char *vla) { int a, c, n = 0; const char *p; - PyObject *result = NULL; + PyObject *result = nullptr; p = vla; c = VLAGetSize(vla); while(c--) { /* count strings */ @@ -1127,7 +1127,7 @@ PyObject *PConvStringVLAToPyList(const char *vla) int PConvPyListToStringVLA(PyObject * obj, char **vla_ptr) { int a, l, ll; - char *vla = NULL, *q; + char *vla = nullptr, *q; PyObject *i; if(obj) if(PyList_Check(obj)) { diff --git a/layer1/PConv.h b/layer1/PConv.h index 21e5f5975..6aacec94c 100644 --- a/layer1/PConv.h +++ b/layer1/PConv.h @@ -90,7 +90,7 @@ Z* ------------------------------------------------------------------- /* NOTE: the string routines will write strings up to the specified - * length, PLUS a NULL...so watch out for array overruns */ + * length, PLUS a nullptr...so watch out for array overruns */ int PConvAttrToStrMaxLen(PyObject * obj, const char *attr, char *str, ov_size ll); @@ -151,7 +151,7 @@ int PConvPyObjectToChar(PyObject * object, char *value); /* NOTE: the string routines will write strings up to the specified - * length, PLUS a NULL...so watch out for array overruns */ + * length, PLUS a nullptr...so watch out for array overruns */ int PConvPyObjectToStrMaxLen(PyObject * object, char *value, int ln); int PConvPyObjectToStrMaxClean(PyObject * object, char *value, int ln); diff --git a/layer1/Picking.cpp b/layer1/Picking.cpp index bce1feedc..11a4a61b2 100644 --- a/layer1/Picking.cpp +++ b/layer1/Picking.cpp @@ -187,7 +187,7 @@ void PickColorManager::colorNext(unsigned char* color, /** * Get identifier for the 1-based picking color index. - * Returns NULL if the index is out of bounds. + * Returns nullptr if the index is out of bounds. */ const Picking* PickColorManager::getIdentifier(unsigned index) const { diff --git a/layer1/Pop.cpp b/layer1/Pop.cpp index eea647730..9a98d3f8d 100644 --- a/layer1/Pop.cpp +++ b/layer1/Pop.cpp @@ -58,7 +58,7 @@ void PopFree(PyMOLGlobals * G) /*========================================================================*/ int PopInit(PyMOLGlobals * G) { - CPop *I = NULL; + CPop *I = nullptr; if((I = (G->Pop = new CPop(G)))) { I->active = false; diff --git a/layer1/PyMOLObject.cpp b/layer1/PyMOLObject.cpp index caf8b2975..969fdeefe 100644 --- a/layer1/PyMOLObject.cpp +++ b/layer1/PyMOLObject.cpp @@ -63,11 +63,11 @@ int ObjectMotionGetLength(pymol::CObject *I) void ObjectMotionReinterpolate(pymol::CObject *I) { - float power = SettingGet_f(I->G, NULL, I->Setting.get(), cSetting_motion_power); - float bias = SettingGet_f(I->G, NULL, I->Setting.get(), cSetting_motion_bias); - int simple = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_motion_simple); - float linear = SettingGet_f(I->G, NULL, I->Setting.get(), cSetting_motion_linear); - int hand = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_motion_hand); + float power = SettingGet_f(I->G, nullptr, I->Setting.get(), cSetting_motion_power); + float bias = SettingGet_f(I->G, nullptr, I->Setting.get(), cSetting_motion_bias); + int simple = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_motion_simple); + float linear = SettingGet_f(I->G, nullptr, I->Setting.get(), cSetting_motion_linear); + int hand = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_motion_hand); /* int ObjectMotion(pymol::CObject * I, int action, int first, @@ -206,7 +206,7 @@ int ObjectMotion(pymol::CObject * I, int action, int first, ViewElemSmooth(I->ViewElem + first, I->ViewElem + last, window, wrap); } } - if(SettingGet_b(I->G, NULL, I->Setting.get(), cSetting_movie_auto_interpolate)){ + if(SettingGet_b(I->G, nullptr, I->Setting.get(), cSetting_movie_auto_interpolate)){ action = 3; /* reinterpolate */ last = save_last; } @@ -287,7 +287,7 @@ int ObjectMotion(pymol::CObject * I, int action, int first, case 2: /* interpolate & reinterpolate */ case 3: { - CViewElem *first_view = NULL, *last_view = NULL; + CViewElem *first_view = nullptr, *last_view = nullptr; int view_found = false; if(first < 0) @@ -389,7 +389,7 @@ int ObjectMotion(pymol::CObject * I, int action, int first, power, bias, simple, linear, hand, 0.0F); } first_view = last_view; - last_view = NULL; + last_view = nullptr; } } } @@ -457,10 +457,10 @@ void ObjectAdjustStateRebuildRange(pymol::CObject * I, int *start, int *stop) { /* on entry, start and stop should hold the valid range for the object */ int defer_builds_mode = - SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_defer_builds_mode); - int async_builds = SettingGet_b(I->G, NULL, I->Setting.get(), cSetting_async_builds); - int max_threads = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_max_threads); - int all_states = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_all_states); + SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_defer_builds_mode); + int async_builds = SettingGet_b(I->G, nullptr, I->Setting.get(), cSetting_async_builds); + int max_threads = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_max_threads); + int all_states = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_all_states); int dummy; if (all_states) return; @@ -625,7 +625,7 @@ void ObjectMakeValidName(PyMOLGlobals * G, char *name, bool quiet) /** * Get a pointer to an object state. * @param state State (0-indexed) or -2/-3 for current state - * @return NULL if state is out of bounds or empty + * @return nullptr if state is out of bounds or empty */ CObjectState* pymol::CObject::getObjectState(int state) { @@ -672,7 +672,7 @@ int ObjectGetCurrentState(const pymol::CObject * I, int ignore_all_states) // object-level state=0 (all states) if (!ignore_all_states && - SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_all_states)) + SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_all_states)) return -1; return std::max(-1, I->getCurrentState()); @@ -680,7 +680,7 @@ int ObjectGetCurrentState(const pymol::CObject * I, int ignore_all_states) PyObject *ObjectAsPyList(const pymol::CObject * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(14); PyList_SetItem(result, 0, PyInt_FromLong(I->type)); PyList_SetItem(result, 1, PyString_FromString(I->Name)); @@ -712,7 +712,7 @@ int ObjectFromPyList(PyMOLGlobals * G, PyObject * list, pymol::CObject * I) int ll = 0; I->G = G; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -758,7 +758,7 @@ int ObjectFromPyList(PyMOLGlobals * G, PyObject * list, pymol::CObject * I) PyObject *tmp; int nFrame; VLAFreeP(I->ViewElem); - I->ViewElem = NULL; + I->ViewElem = nullptr; if(ok) ok = PConvPyIntToInt(PyList_GetItem(list, 12), &nFrame); if(ok && nFrame) { @@ -794,7 +794,7 @@ int ObjectCopyHeader(pymol::CObject * I, const pymol::CObject * src) for(a = 0; a < 16; a++) I->TTT[a] = src->TTT[a]; } - I->ViewElem = NULL; /* to do */ + I->ViewElem = nullptr; /* to do */ return (ok); } @@ -819,7 +819,7 @@ void ObjectCombineTTT(pymol::CObject * I, const float *ttt, int reverse_order, i combineTTT44f44f(ttt, cpy, I->TTT); } if(store<0) - store = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_movie_auto_store); + store = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_movie_auto_store); if(store && MovieDefined(I->G)) { if(!I->ViewElem) I->ViewElem = pymol::vla(0); @@ -850,7 +850,7 @@ void ObjectTranslateTTT(pymol::CObject * I, const float *v, int store) I->TTT[11] += v[2]; } if(store<0) - store = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_movie_auto_store); + store = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_movie_auto_store); if(store && MovieDefined(I->G)) { if(!I->ViewElem) I->ViewElem = pymol::vla(0); @@ -879,7 +879,7 @@ void ObjectSetTTT(pymol::CObject * I, const float *ttt, int state, int store) return; } if(store<0) - store = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_movie_auto_store); + store = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_movie_auto_store); if(store && MovieDefined(I->G)) { if(!I->ViewElem) I->ViewElem = pymol::vla(0); @@ -905,7 +905,7 @@ int ObjectGetTTT(pymol::CObject * I, const float **ttt, int state) *ttt = I->TTT; return 1; } else { - *ttt = NULL; + *ttt = nullptr; } } else { @@ -920,7 +920,7 @@ void ObjectResetTTT(pymol::CObject * I,int store) I->TTTFlag = false; if(store<0) - store = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_movie_auto_store); + store = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_movie_auto_store); if(store && MovieDefined(I->G)) { if(!I->ViewElem) I->ViewElem = pymol::vla(0); @@ -983,7 +983,7 @@ int ObjectGetTotalMatrix(pymol::CObject * I, int state, int history, double *mat /*========================================================================*/ void ObjectPrepareContext(pymol::CObject * I, RenderInfo * info) { - CRay * ray = info ? info->ray : NULL; + CRay * ray = info ? info->ray : nullptr; if(I->ViewElem) { int frame = SceneGetFrame(I->G); @@ -1390,7 +1390,7 @@ void ObjectStateResetMatrix(CObjectState* I) PyObject *ObjectStateAsPyList(CObjectState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; if(I) { result = PyList_New(1); @@ -1413,7 +1413,7 @@ int ObjectStateFromPyList(PyMOLGlobals * G, PyObject * list, CObjectState * I) if(list && (list != Py_None)) { /* allow None */ if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... diff --git a/layer1/PyMOLObject.h b/layer1/PyMOLObject.h index 0ca97deab..33d907464 100644 --- a/layer1/PyMOLObject.h +++ b/layer1/PyMOLObject.h @@ -100,7 +100,7 @@ struct CObject { CObject(PyMOLGlobals* G); /// @pre `0 <= state && state < getNFrame()` - /// @return NULL if state is empty (not active) + /// @return nullptr if state is empty (not active) virtual CObjectState* _getObjectState(int state) { return nullptr; } public: diff --git a/layer1/Ray.cpp b/layer1/Ray.cpp index 101e08dc7..be9ba6e04 100644 --- a/layer1/Ray.cpp +++ b/layer1/Ray.cpp @@ -358,7 +358,7 @@ static void fill_background_image(CRay * I, unsigned int *buffer, int width, int if(opaque_back < 0) opaque_back = SettingGetGlobal_i(I->G, cSetting_opaque_background); - tmpf = ColorGet(I->G, SettingGet_color(I->G, NULL, NULL, cSetting_bg_rgb)); + tmpf = ColorGet(I->G, SettingGet_color(I->G, nullptr, nullptr, cSetting_bg_rgb)); mult3f(tmpf, 255.f, bg_rgb); if(opaque_back) { @@ -1653,7 +1653,7 @@ static VectorHash *VectorHash_New(void) I->elem = VLACalloc(VectorHashElem, 100); if(!I->elem) { VectorHash_Free(I); - I = NULL; + I = nullptr; } } return I; @@ -1752,7 +1752,7 @@ static void unique_vector_add(VectorHash * vh, float *vector, int *index_array, int *index_count) { int index = *vector_count; - switch (VectorHash_GetOrSetKeyValue(vh, vector, NULL, &index)) { + switch (VectorHash_GetOrSetKeyValue(vh, vector, nullptr, &index)) { case 1: { float *vector_slot = vector_array + 3 * (*vector_count); @@ -2218,7 +2218,7 @@ void RayRenderIDTF(CRay * I, char **node_vla, char **rsrc_vla) int mesh_cnt = 0; IdtfResourceMesh *mesh_vla = VLACalloc(IdtfResourceMesh, 1); if(mesh_vla) { - IdtfResourceMesh *mesh = NULL; + IdtfResourceMesh *mesh = nullptr; int a; for(a = 0; a < I->NPrimitive; a++) { @@ -2242,14 +2242,14 @@ void RayRenderIDTF(CRay * I, char **node_vla, char **rsrc_vla) ) { mesh_cnt++; } else { - mesh = NULL; + mesh = nullptr; } } } break; default: /* close/terminate mesh */ if(mesh) { - mesh = NULL; + mesh = nullptr; } break; } @@ -2591,7 +2591,7 @@ void RayRenderPOV(CRay * I, int width, int height, char **headerVLA_ptr, if(antialias < 0) antialias = SettingGetGlobal_i(I->G, cSetting_antialias); - bkrd = ColorGet(I->G, SettingGet_color(I->G, NULL, NULL, cSetting_bg_rgb)); + bkrd = ColorGet(I->G, SettingGet_color(I->G, nullptr, nullptr, cSetting_bg_rgb)); RayExpandPrimitives(I); RayTransformFirst(I, 0, identity); @@ -3272,7 +3272,7 @@ int RayTraceThread(CRayThreadInfo * T) const float *tmpf; int chromadepth; - tmpf = ColorGet(I->G, SettingGet_color(I->G, NULL, NULL, cSetting_bg_rgb)); + tmpf = ColorGet(I->G, SettingGet_color(I->G, nullptr, nullptr, cSetting_bg_rgb)); mult3f(tmpf, 255.f, bg_rgb); /* MemoryDebugDump(); @@ -3449,7 +3449,7 @@ int RayTraceThread(CRayThreadInfo * T) if(I->NBasis > 2) bp2 = I->Basis + 2; else - bp2 = NULL; + bp2 = nullptr; render_height = T->y_stop - T->y_start; @@ -5519,7 +5519,7 @@ extern int n_sausages; extern int n_skipped; #endif -float *rayDepthPixels = NULL; +float *rayDepthPixels = nullptr; int rayVolume = 0, rayWidth = 0, rayHeight = 0; /*========================================================================*/ @@ -5527,7 +5527,7 @@ void RayRender(CRay * I, unsigned int *image, double timing, float angle, int antialias, unsigned int *return_bg) { int a, x, y; - unsigned int *image_copy = NULL; + unsigned int *image_copy = nullptr; unsigned int back_mask, fore_mask = 0, trace_word = 0; unsigned int background; size_t buffer_size; @@ -5544,7 +5544,7 @@ void RayRender(CRay * I, unsigned int *image, double timing, int perspective = SettingGetGlobal_i(I->G, cSetting_ray_orthoscopic); int n_light = SettingGetGlobal_i(I->G, cSetting_light_count); float ambient; - float *depth = NULL; + float *depth = nullptr; float front = I->Volume[4]; float back = I->Volume[5]; float fov = I->Fov; @@ -5630,7 +5630,7 @@ void RayRender(CRay * I, unsigned int *image, double timing, ambient = SettingGetGlobal_f(I->G, cSetting_ambient); bkrd_is_gradient = SettingGetGlobal_b(I->G, cSetting_bg_gradient); - bg_image_filename = SettingGet_s(I->G, NULL, NULL, cSetting_bg_image_filename); + bg_image_filename = SettingGet_s(I->G, nullptr, nullptr, cSetting_bg_image_filename); I->bkgrd_data = OrthoBackgroundDataGet(*I->G->Ortho); if (!I->bkgrd_data && bg_image_filename && bg_image_filename[0]){ I->bkgrd_data = MyPNGRead(bg_image_filename); @@ -5644,12 +5644,12 @@ void RayRender(CRay * I, unsigned int *image, double timing, bkrd_is_gradient = 0; } if (bkrd_is_gradient){ - bkrd_ptr = ColorGet(I->G, SettingGet_color(I->G, NULL, NULL, cSetting_bg_rgb_top)); + bkrd_ptr = ColorGet(I->G, SettingGet_color(I->G, nullptr, nullptr, cSetting_bg_rgb_top)); copy3f(bkrd_ptr, bkrd_top); - bkrd_ptr = ColorGet(I->G, SettingGet_color(I->G, NULL, NULL, cSetting_bg_rgb_bottom)); + bkrd_ptr = ColorGet(I->G, SettingGet_color(I->G, nullptr, nullptr, cSetting_bg_rgb_bottom)); copy3f(bkrd_ptr, bkrd_bottom); } else { - bkrd_ptr = ColorGet(I->G, SettingGet_color(I->G, NULL, NULL, cSetting_bg_rgb)); + bkrd_ptr = ColorGet(I->G, SettingGet_color(I->G, nullptr, nullptr, cSetting_bg_rgb)); copy3f(bkrd_ptr, bkrd_top); copy3f(bkrd_ptr, bkrd_bottom); } @@ -5917,7 +5917,7 @@ void RayRender(CRay * I, unsigned int *image, double timing, thread_info[bc - 1].vert2prim = vert2prim_ptr; thread_info[bc - 1].prim = I->Primitive; thread_info[bc - 1].n_prim = I->NPrimitive; - thread_info[bc - 1].clipBox = NULL; + thread_info[bc - 1].clipBox = nullptr; thread_info[bc - 1].phase = bc - 1; thread_info[bc - 1].perspective = false; thread_info[bc - 1].front = _0; @@ -5945,7 +5945,7 @@ void RayRender(CRay * I, unsigned int *image, double timing, float factor = SettingGetGlobal_f(I->G, cSetting_ray_hint_shadow); for(bc = 2; ok && bc < I->NBasis; bc++) { ok &= BasisMakeMap(I->Basis + bc, vert2prim_ptr, I->Primitive, I->NPrimitive, - NULL, bc - 1, cCache_ray_map, false, _0, I->PrimSize * factor); + nullptr, bc - 1, cCache_ray_map, false, _0, I->PrimSize * factor); } } @@ -6097,7 +6097,7 @@ void RayRender(CRay * I, unsigned int *image, double timing, rt[a].background = background; rt[a].phase = a; rt[a].n_thread = n_thread; - rt[a].edging = NULL; + rt[a].edging = nullptr; rt[a].edging_cutoff = oversample_cutoff; /* info needed for busy indicator */ rt[a].perspective = perspective; rt[a].fov = fov; @@ -7519,7 +7519,7 @@ CRay *RayNew(PyMOLGlobals * G, int antialias) BasisInit(I->G, I->Basis, 0); BasisInit(I->G, I->Basis + 1, 1); I->NBasis = 2; - I->Primitive = NULL; + I->Primitive = nullptr; I->NPrimitive = 0; I->CheckInterior = false; if(antialias < 0) @@ -7531,7 +7531,7 @@ CRay *RayNew(PyMOLGlobals * G, int antialias) I->Random[a] = (float) ((rand() / (1.0 + RAND_MAX)) - 0.5); } - I->Wobble = SettingGet_i(I->G, NULL, NULL, cSetting_ray_texture); + I->Wobble = SettingGet_i(I->G, nullptr, nullptr, cSetting_ray_texture); { auto v = SettingGet(I->G, cSetting_ray_texture_settings); int color = SettingGetGlobal_color(I->G, cSetting_ray_interior_color); diff --git a/layer1/Rep.cpp b/layer1/Rep.cpp index 214a7c958..68b029563 100644 --- a/layer1/Rep.cpp +++ b/layer1/Rep.cpp @@ -59,7 +59,7 @@ Rep* Rep::rebuild() /*========================================================================*/ /** * Rebuild if necessary (according to invalidation status). Returns either this - * instance, or deletes this instance and returns a new one, or NULL if the rep + * instance, or deletes this instance and returns a new one, or nullptr if the rep * became empty/inactive. */ Rep* Rep::update() diff --git a/layer1/Scene.cpp b/layer1/Scene.cpp index faffdfd4d..646e5a46d 100644 --- a/layer1/Scene.cpp +++ b/layer1/Scene.cpp @@ -360,7 +360,7 @@ void ScenePrimeAnimation(PyMOLGlobals * G) if(G->HaveGUI) { CScene *I = G->Scene; UtilZeroMem(I->ani_elem, sizeof(CViewElem)); - SceneToViewElem(G, I->ani_elem, NULL); + SceneToViewElem(G, I->ani_elem, nullptr); I->ani_elem[0].specification_level = 2; I->n_ani_elem = 0; } @@ -435,7 +435,7 @@ void SceneLoadAnimation(PyMOLGlobals * G, double duration, int hand) if(target > MAX_ANI_ELEM) target = MAX_ANI_ELEM; UtilZeroMem(I->ani_elem + 1, sizeof(CViewElem) * target); - SceneToViewElem(G, I->ani_elem + target, NULL); + SceneToViewElem(G, I->ani_elem + target, nullptr); I->ani_elem[target].specification_level = 2; now = UtilGetSeconds(G); I->ani_elem[0].timing_flag = true; @@ -1168,7 +1168,7 @@ void SceneTranslateScaled(PyMOLGlobals * G, float x, float y, float z, int sdof_ switch (sdof_mode) { case SDOF_NORMAL_MODE: if((x != 0.0F) || (y != 0.0F)) { - float vScale = SceneGetExactScreenVertexScale(G, NULL); + float vScale = SceneGetExactScreenVertexScale(G, nullptr); float factor = vScale * (I->Height + I->Width) / 2; I->m_view.translate(x * factor, y * factor, 0.0f); invalidate = true; @@ -1187,7 +1187,7 @@ void SceneTranslateScaled(PyMOLGlobals * G, float x, float y, float z, int sdof_ break; case SDOF_CLIP_MODE: if((x != 0.0F) || (y != 0.0F)) { - float vScale = SceneGetExactScreenVertexScale(G, NULL); + float vScale = SceneGetExactScreenVertexScale(G, nullptr); float factor = vScale * (I->Height + I->Width) / 2; I->m_view.translate(x * factor, y * factor, 0.0f); invalidate = true; @@ -1214,7 +1214,7 @@ void SceneTranslateScaled(PyMOLGlobals * G, float x, float y, float z, int sdof_ { /* when dragging, we treat all axes proportionately */ - float vScale = SceneGetExactScreenVertexScale(G, NULL); + float vScale = SceneGetExactScreenVertexScale(G, nullptr); float factor = vScale * (I->Height + I->Width) / 2; x *= factor; y *= factor; @@ -1228,8 +1228,8 @@ void SceneTranslateScaled(PyMOLGlobals * G, float x, float y, float z, int sdof_ /* transform into model coodinate space */ MatrixInvTransformC44fAs33f3f(glm::value_ptr(I->m_view.rotMatrix()), v2, v2); - EditorDrag(G, NULL, -1, cButModeMovDrag, - SettingGetGlobal_i(G, cSetting_state) - 1, NULL, v2, NULL); + EditorDrag(G, nullptr, -1, cButModeMovDrag, + SettingGetGlobal_i(G, cSetting_state) - 1, nullptr, v2, nullptr); } break; } @@ -1300,8 +1300,8 @@ void SceneRotateScaled(PyMOLGlobals * G, float rx, float ry, float rz, int sdof_ /* transform into model coodinate space */ MatrixInvTransformC44fAs33f3f(glm::value_ptr(I->m_view.rotMatrix()), axis, v2); - EditorDrag(G, NULL, -1, cButModeRotDrag, - SettingGetGlobal_i(G, cSetting_state) - 1, v1, v2, NULL); + EditorDrag(G, nullptr, -1, cButModeRotDrag, + SettingGetGlobal_i(G, cSetting_state) - 1, v1, v2, nullptr); invalidate = true; } } @@ -1396,14 +1396,14 @@ void SceneClip(PyMOLGlobals * G, SceneClipMode mode, float movement, const char case SceneClipMode::Slab: if(sele[0]) { if(!ExecutiveGetExtent(G, sele, mn, mx, true, state, false)) - sele = NULL; + sele = nullptr; else { average3f(mn, mx, cent); /* get center of selection */ subtract3f(cent, glm::value_ptr(I->m_view.origin()), v0); /* how far from origin? */ MatrixTransformC44fAs33f3f(glm::value_ptr(I->m_view.rotMatrix()), v0, offset); /* convert to view-space */ } } else { - sele = NULL; + sele = nullptr; } avg = (I->m_view.m_clip().m_front + I->m_view.m_clip().m_back) / 2.0F; movement /= 2.0F; @@ -1425,7 +1425,7 @@ void SceneClip(PyMOLGlobals * G, SceneClipMode mode, float movement, const char SceneClipSet(G, -pos.z - movement, -pos.z + movement); } else { if(!ExecutiveGetCameraExtent(G, sele, mn, mx, true, state)) - sele = NULL; + sele = nullptr; if(sele) { if(sele[0]) { average3f(mn, mx, cent); /* get center of selection */ @@ -1434,7 +1434,7 @@ void SceneClip(PyMOLGlobals * G, SceneClipMode mode, float movement, const char subtract3f(mn, origin, mn); /* how far from origin? */ SceneClipSet(G, -pos.z - mx[2] - movement, -pos.z - mn[2] + movement); } else { - sele = NULL; + sele = nullptr; } } } @@ -1843,7 +1843,7 @@ static int SceneMakeSizedImage(PyMOLGlobals * G, int width, int height, int anti * * Modifies `G->Scene->Image`. * - * @param prior_only Return NULL if there is no prior image (`G->Scene->Image` is NULL) + * @param prior_only Return nullptr if there is no prior image (`G->Scene->Image` is nullptr) * @return The scene image */ pymol::Image* SceneImagePrepare(PyMOLGlobals* G, bool prior_only) @@ -2287,7 +2287,7 @@ int SceneMakeMovieImage(PyMOLGlobals * G, switch (mode) { case cSceneImage_Ray: SceneRay(G, width, height, SettingGetGlobal_i(G, cSetting_ray_default_renderer), - NULL, NULL, 0.0F, 0.0F, false, NULL, show_timing, -1); + nullptr, nullptr, 0.0F, 0.0F, false, nullptr, show_timing, -1); break; case cSceneImage_Draw: SceneMakeSizedImage(G, width, height, SettingGetGlobal_i(G, cSetting_antialias)); @@ -3028,7 +3028,7 @@ int SceneDrawImageOverlay(PyMOLGlobals * G, int override , CGO *orthoCGO){ if(((!text) || overlay) && (override || I->CopyType == true) && I->Image && !I->Image->empty()) { /* show transparent bg as checkboard? */ int show_alpha = SettingGetGlobal_b(G, cSetting_show_alpha_checker); - const float *bg_color = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)); + const float *bg_color = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)); unsigned int bg_rr, bg_r = (unsigned int) (255 * bg_color[0]); unsigned int bg_gg, bg_g = (unsigned int) (255 * bg_color[1]); unsigned int bg_bb, bg_b = (unsigned int) (255 * bg_color[2]); @@ -3373,7 +3373,7 @@ void SceneDoRoving(PyMOLGlobals * G, float old_front, float old_back, float old_origin, int adjust_flag, int zoom_flag) { - EditorFavorOrigin(G, NULL); + EditorFavorOrigin(G, nullptr); if(SettingGetGlobal_b(G, cSetting_roving_origin)) { CScene *I = G->Scene; @@ -3530,7 +3530,7 @@ bool SceneGetVisible(PyMOLGlobals * G, const float *v1) /** * Get the depth (camera space Z) of v1 * - * @param v1 point (3f) in world space or NULL (= origin) + * @param v1 point (3f) in world space or nullptr (= origin) */ float SceneGetRawDepth(PyMOLGlobals * G, const float *v1) { @@ -3551,7 +3551,7 @@ float SceneGetRawDepth(PyMOLGlobals * G, const float *v1) * Get the depth (camera space Z) of v1 in normalized clip space * from 0.0 (near) to 1.0 (far) * - * @param v1 point (3f) in world space or NULL (= origin) + * @param v1 point (3f) in world space or nullptr (= origin) */ float SceneGetDepth(PyMOLGlobals * G, const float *v1) { @@ -3562,10 +3562,10 @@ float SceneGetDepth(PyMOLGlobals * G, const float *v1) /*========================================================================*/ /** - * Get the angstrom per pixel factor at v1. If v1 is NULL, return the + * Get the angstrom per pixel factor at v1. If v1 is nullptr, return the * factor at the origin, but clamped to an empirical positive value. * - * @param v1 point (3f) in world space or NULL (= origin) + * @param v1 point (3f) in world space or nullptr (= origin) */ float SceneGetScreenVertexScale(PyMOLGlobals * G, const float *v1) @@ -3597,7 +3597,7 @@ static void SceneRovingCleanup(PyMOLGlobals * G) I->RovingCleanupFlag = false; - s = SettingGet_s(G, NULL, NULL, cSetting_roving_selection); + s = SettingGet_s(G, nullptr, nullptr, cSetting_roving_selection); sprintf(buffer, "cmd.hide('lines','''%s''')", s); PParse(G, buffer); @@ -3648,7 +3648,7 @@ void SceneRovingUpdate(PyMOLGlobals * G) if(I->RovingCleanupFlag) SceneRovingCleanup(G); - s = SettingGet_s(G, NULL, NULL, cSetting_roving_selection); + s = SettingGet_s(G, nullptr, nullptr, cSetting_roving_selection); sticks = SettingGetGlobal_f(G, cSetting_roving_sticks); lines = SettingGetGlobal_f(G, cSetting_roving_lines); labels = SettingGetGlobal_f(G, cSetting_roving_labels); @@ -3816,7 +3816,7 @@ void SceneRovingUpdate(PyMOLGlobals * G) auto_save = SettingGetGlobal_i(G, cSetting_auto_zoom); SettingSetGlobal_i(G, cSetting_auto_zoom, 0); - name = SettingGet_s(G, NULL, NULL, cSetting_roving_map1_name); + name = SettingGet_s(G, nullptr, nullptr, cSetting_roving_map1_name); if(name) if(name[0]) if(ExecutiveFindObjectByName(G, name)) { @@ -3829,7 +3829,7 @@ void SceneRovingUpdate(PyMOLGlobals * G) refresh_flag = true; } - name = SettingGet_s(G, NULL, NULL, cSetting_roving_map2_name); + name = SettingGet_s(G, nullptr, nullptr, cSetting_roving_map2_name); if(name) if(name[0]) if(ExecutiveFindObjectByName(G, name)) { @@ -3842,7 +3842,7 @@ void SceneRovingUpdate(PyMOLGlobals * G) refresh_flag = true; } - name = SettingGet_s(G, NULL, NULL, cSetting_roving_map3_name); + name = SettingGet_s(G, nullptr, nullptr, cSetting_roving_map3_name); if(name) if(name[0]) if(ExecutiveFindObjectByName(G, name)) { @@ -3863,7 +3863,7 @@ void SceneRovingUpdate(PyMOLGlobals * G) auto_save = SettingGetGlobal_i(G, cSetting_auto_zoom); SettingSetGlobal_i(G, cSetting_auto_zoom, 0); - name = SettingGet_s(G, NULL, NULL, cSetting_roving_map1_name); + name = SettingGet_s(G, nullptr, nullptr, cSetting_roving_map1_name); if(name) if(name[0]) if(ExecutiveFindObjectByName(G, name)) { @@ -3876,7 +3876,7 @@ void SceneRovingUpdate(PyMOLGlobals * G) refresh_flag = true; } - name = SettingGet_s(G, NULL, NULL, cSetting_roving_map2_name); + name = SettingGet_s(G, nullptr, nullptr, cSetting_roving_map2_name); if(name) if(name[0]) if(ExecutiveFindObjectByName(G, name)) { @@ -3889,7 +3889,7 @@ void SceneRovingUpdate(PyMOLGlobals * G) refresh_flag = true; } - name = SettingGet_s(G, NULL, NULL, cSetting_roving_map3_name); + name = SettingGet_s(G, nullptr, nullptr, cSetting_roving_map3_name); if(name) if(name[0]) if(ExecutiveFindObjectByName(G, name)) { @@ -3964,7 +3964,7 @@ bool call_raw_image_callback(PyMOLGlobals * G) { * @param dpi dots per inch * @param format ?? * @param quiet if true, don't print messages - * @param out_img if not NULL, store the image data here + * @param out_img if not nullptr, store the image data here * @param filename if not empty, store the image to this file as PNG */ @@ -4127,7 +4127,7 @@ int SceneReinitialize(PyMOLGlobals * G) /*========================================================================*/ int SceneInit(PyMOLGlobals * G) { - CScene *I = NULL; + CScene *I = nullptr; I = (G->Scene = new CScene(G)); if(I) { assert(!I->RovingDirtyFlag); @@ -4697,11 +4697,11 @@ void SceneUpdate(PyMOLGlobals * G, int force) for ( auto it = I->Obj.begin(); it != I->Obj.end(); ++it) { if ((*it)->type != cObjectMolecule || force || defer_builds_mode != 5) { int static_singletons = - SettingGet_b(G, (*it)->Setting.get(), NULL, cSetting_static_singletons); + SettingGet_b(G, (*it)->Setting.get(), nullptr, cSetting_static_singletons); int async_builds = - SettingGet_b(G, (*it)->Setting.get(), NULL, cSetting_async_builds); + SettingGet_b(G, (*it)->Setting.get(), nullptr, cSetting_async_builds); int max_threads = - SettingGet_i(G, (*it)->Setting.get(), NULL, cSetting_max_threads); + SettingGet_i(G, (*it)->Setting.get(), nullptr, cSetting_max_threads); int nFrame = 0; nFrame = (*it)->getNFrame(); if((nFrame > 1) || (!static_singletons)) { @@ -4775,11 +4775,11 @@ int SceneRenderCached(PyMOLGlobals * G) auto show_progress = SettingGet(G, cSetting_show_progress); SettingSetGlobal_i(G, cSetting_show_progress, 0); SceneRay(G, 0, 0, SettingGetGlobal_i(G, cSetting_ray_default_renderer), - NULL, NULL, 0.0F, 0.0F, false, NULL, false, -1); + nullptr, nullptr, 0.0F, 0.0F, false, nullptr, false, -1); SettingSetGlobal_i(G,cSetting_show_progress, show_progress); } else if(moviePlaying && SettingGetGlobal_b(G, cSetting_ray_trace_frames)) { SceneRay(G, 0, 0, SettingGetGlobal_i(G, cSetting_ray_default_renderer), - NULL, NULL, 0.0F, 0.0F, false, NULL, true, -1); + nullptr, nullptr, 0.0F, 0.0F, false, nullptr, true, -1); } else if((moviePlaying && SettingGetGlobal_b(G, cSetting_draw_frames)) || (draw_mode == 2)) { SceneMakeSizedImage(G, 0, 0, SettingGetGlobal_i(G, cSetting_antialias)); } else if(I->CopyType == true) { /* true vs. 2 */ @@ -5312,7 +5312,7 @@ void SceneZoom(PyMOLGlobals * G, float scale){ } int SceneGetTwoSidedLighting(PyMOLGlobals * G){ - return SceneGetTwoSidedLightingSettings(G, NULL, NULL); + return SceneGetTwoSidedLightingSettings(G, nullptr, nullptr); } int SceneGetTwoSidedLightingSettings(PyMOLGlobals * G, @@ -5446,7 +5446,7 @@ void SceneTranslateSceneXYWithScale(PyMOLGlobals * G, float x, float y){ vScale = SceneGetExactScreenVertexScale(G, glm::value_ptr(I->m_view.origin())); /* if(stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); }*/ v2[0] = x * vScale; @@ -5467,7 +5467,7 @@ void SceneTranslateSceneXYWithScale(PyMOLGlobals * G, float x, float y){ moved_flag = true; } I->m_view.setPos(pos); - EditorFavorOrigin(G, NULL); + EditorFavorOrigin(G, nullptr); if(moved_flag && SettingGetGlobal_b(G, cSetting_roving_origin)) { SceneGetCenter(G, v2); /* gets position of center of screen */ SceneOriginSet(G, v2, true); diff --git a/layer1/Scene.h b/layer1/Scene.h index 4e4440b4e..466711fb3 100644 --- a/layer1/Scene.h +++ b/layer1/Scene.h @@ -244,7 +244,7 @@ int SceneGetBackgroundColorAlreadySet(PyMOLGlobals * G); void SceneSetDoNotClearBackground(PyMOLGlobals * G, int); int SceneGetDoNotClearBackground(PyMOLGlobals * G); -void SceneProgramLighting(PyMOLGlobals * G, CShaderPrg * shaderPrg = NULL); +void SceneProgramLighting(PyMOLGlobals * G, CShaderPrg * shaderPrg = nullptr); void SceneGLClear(PyMOLGlobals * G, GLbitfield mask); #ifdef _PYMOL_IOS diff --git a/layer1/SceneMouse.cpp b/layer1/SceneMouse.cpp index 6aee75676..72d8dddfc 100644 --- a/layer1/SceneMouse.cpp +++ b/layer1/SceneMouse.cpp @@ -34,7 +34,7 @@ NamedPicking::NamedPicking(const Picking& pick) static void SceneNoteMouseInteraction(PyMOLGlobals* G) { SceneAbortAnimation(G); - if (SettingGet_b(G, NULL, NULL, cSetting_mouse_restart_movie_delay)) { + if (SettingGet_b(G, nullptr, nullptr, cSetting_mouse_restart_movie_delay)) { SceneRestartFrameTimer(G); } } @@ -113,7 +113,7 @@ void SceneClickButtonAddTo(PyMOLGlobals* G, pymol::CObject* obj, } } else { auto buf2 = pymol::string_format("%s(%s)", sel_mode_kw, buffer); - SelectorCreate(G, selName.c_str(), buf2.c_str(), NULL, false, NULL); + SelectorCreate(G, selName.c_str(), buf2.c_str(), nullptr, false, nullptr); if (obj->type == cObjectMolecule) { if (SettingGet(G, cSetting_logging)) { auto objMol = (ObjectMolecule*) obj; @@ -284,7 +284,7 @@ void SceneClickObject(PyMOLGlobals* G, pymol::CObject* obj, const NamedPicking& if (ObjectMoleculeGetAtomTxfVertex((ObjectMolecule*) obj, LastPicked.context.state, LastPicked.src.index, v1)) { EditorFavorOrigin(G, v1); - ExecutiveOrigin(G, NULL, true, NULL, v1, 0); + ExecutiveOrigin(G, nullptr, true, nullptr, v1, 0); } } if (obj->type == cObjectMolecule) { @@ -503,7 +503,7 @@ void SceneClickPickBond(PyMOLGlobals* G, int x, int y, int mode, const NamedPick { auto buffer = pymol::string_format("%s`%d", obj->Name, I->LastPicked.src.index + 1); - SelectorCreate(G, cEditorSele1, buffer.c_str(), NULL, true, NULL); + SelectorCreate(G, cEditorSele1, buffer.c_str(), nullptr, true, nullptr); } if (LastPicked.src.bond >= 0) { @@ -524,7 +524,7 @@ void SceneClickPickBond(PyMOLGlobals* G, int x, int y, int mode, const NamedPick PLog(G, buffer, cPLog_pym); } auto buffer = pymol::string_format("%s`%d", obj->Name, atIndex + 1); - SelectorCreate(G, cEditorSele2, buffer.c_str(), NULL, true, NULL); + SelectorCreate(G, cEditorSele2, buffer.c_str(), nullptr, true, nullptr); EditorActivate(G, SettingGetGlobal_i(G, cSetting_state) - 1, true); if (mode == cButModePkTorBnd) { @@ -816,7 +816,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) x = x - I->margin.left; if (stereo_via_adjacent_array(I->StereoMode)) - x = get_stereo_x(x, NULL, I->Width, NULL); + x = get_stereo_x(x, nullptr, I->Width, nullptr); I->LastX = x; I->LastY = y; @@ -826,7 +826,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) auto obj = EditorDragObject(G); if (obj) { if (SettingGetGlobal_b(G, cSetting_movie_auto_store)) { - ObjectTranslateTTT(obj, NULL, true); + ObjectTranslateTTT(obj, nullptr, true); I->MotionGrabbedObj = obj; obj->Grabbed = true; if (SettingGetGlobal_i(G, cSetting_movie_auto_interpolate)) { @@ -834,7 +834,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) I->ReinterpolateObj = obj; } } else { - ObjectTranslateTTT(obj, NULL, false); + ObjectTranslateTTT(obj, nullptr, false); } } } @@ -857,7 +857,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) x = x - I->margin.left; if (stereo_via_adjacent_array(I->StereoMode)) - x = get_stereo_x(x, NULL, I->Width, NULL); + x = get_stereo_x(x, nullptr, I->Width, nullptr); I->LastX = x; I->LastY = y; @@ -866,7 +866,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) case cButModePickAtom: case cButModeMenu: if (stereo_via_adjacent_array(I->StereoMode)) - x = get_stereo_x(x, NULL, I->Width, NULL); + x = get_stereo_x(x, nullptr, I->Width, nullptr); if (SceneDoXYPick(G, x, y, click_side)) { auto obj = I->LastPicked.context.object; @@ -895,7 +895,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) case cButModePickBond: case cButModePkTorBnd: if (stereo_via_adjacent_array(I->StereoMode)) - x = get_stereo_x(x, NULL, I->Width, &click_side); + x = get_stereo_x(x, nullptr, I->Width, &click_side); if (SceneDoXYPick(G, x, y, click_side)) { y = y - I->margin.bottom; @@ -928,7 +928,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) case cButModeMoveAtom: case cButModeMoveAtomZ: if (stereo_via_adjacent_array(I->StereoMode)) - x = get_stereo_x(x, NULL, I->Width, &click_side); + x = get_stereo_x(x, nullptr, I->Width, &click_side); if (SceneDoXYPick(G, x, y, click_side)) { auto obj = I->LastPicked.context.object; @@ -963,7 +963,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) case cButModeRotView: case cButModeMovView: { if (SettingGetGlobal_b(G, cSetting_movie_auto_store)) { - ObjectTranslateTTT(obj, NULL, true); + ObjectTranslateTTT(obj, nullptr, true); I->MotionGrabbedObj = obj; obj->Grabbed = true; if (SettingGetGlobal_i(G, cSetting_movie_auto_interpolate)) { @@ -971,7 +971,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) I->ReinterpolateObj = obj; } } else { - ObjectTranslateTTT(obj, NULL, false); + ObjectTranslateTTT(obj, nullptr, false); } } break; } @@ -1031,7 +1031,7 @@ void SceneClick(Block* block, int button, int x, int y, int mod, double when) case cButModeDragMol: case cButModeDragObj: if (stereo_via_adjacent_array(I->StereoMode)) - x = get_stereo_x(x, NULL, I->Width, &click_side); + x = get_stereo_x(x, nullptr, I->Width, &click_side); if (SceneDoXYPick(G, x, y, click_side)) { auto obj = I->LastPicked.context.object; @@ -1188,12 +1188,12 @@ void SceneRelease(Block* block, int button, int x, int y, int mod, double when) ObjectMotionReinterpolate(I->ReinterpolateObj); } I->ReinterpolateFlag = true; - I->ReinterpolateObj = NULL; + I->ReinterpolateObj = nullptr; } if (I->MotionGrabbedObj) { if (ExecutiveValidateObjectPtr(G, I->MotionGrabbedObj, 0)) { I->MotionGrabbedObj->Grabbed = false; - I->MotionGrabbedObj = NULL; + I->MotionGrabbedObj = nullptr; } } } @@ -1325,7 +1325,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) vScale = SceneGetExactScreenVertexScale(G, v1); if (stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } /* transform into model coodinate space */ @@ -1366,11 +1366,11 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) eff_width = I->Width; if (stereo_via_adjacent_array(I->StereoMode)) { eff_width = I->Width / 2; - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } virtual_trackball = - SettingGet_i(G, NULL, NULL, cSetting_virtual_trackball); + SettingGet_i(G, nullptr, nullptr, cSetting_virtual_trackball); if (virtual_trackball == 2 && (!I->prev_no_z_rotation1 || !I->prev_no_z_rotation2)) { @@ -1428,12 +1428,12 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) normalize23f(v2, n2); cross_product3f(n1, n2, cp); theta = - (float) (SettingGet_f(G, NULL, NULL, cSetting_mouse_scale) * 2 * 180 * + (float) (SettingGet_f(G, nullptr, nullptr, cSetting_mouse_scale) * 2 * 180 * asin(sqrt1f(cp[0] * cp[0] + cp[1] * cp[1] + cp[2] * cp[2])) / cPI); dx = (v1[0] - v2[0]); dy = (v1[1] - v2[1]); - dt = (float) (SettingGet_f(G, NULL, NULL, cSetting_mouse_limit) * + dt = (float) (SettingGet_f(G, nullptr, nullptr, cSetting_mouse_limit) * sqrt1f(dx * dx + dy * dy) / scale); if (theta > dt) @@ -1448,7 +1448,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) /* transform into model coodinate space */ MatrixInvTransformC44fAs33f3f(glm::value_ptr(I->m_view.rotMatrix()), axis, v2); v1[0] = (float) (cPI * theta / 180.0); - EditorDrag(G, NULL, -1, mode, SettingGetGlobal_i(G, cSetting_state) - 1, + EditorDrag(G, nullptr, -1, mode, SettingGetGlobal_i(G, cSetting_state) - 1, v1, v2, v3); I->LastX = x; I->LastY = y; @@ -1466,7 +1466,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) copy3f(glm::value_ptr(I->m_view.origin()), v1); vScale = SceneGetExactScreenVertexScale(G, v1); if (stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } if (mode == cButModeMovDragZ) { @@ -1487,7 +1487,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) MatrixInvTransformC44fAs33f3f(glm::value_ptr(I->m_view.rotMatrix()), v2, v2); MatrixInvTransformC44fAs33f3f(glm::value_ptr(I->m_view.rotMatrix()), v3, v3); - EditorDrag(G, NULL, -1, mode, SettingGetGlobal_i(G, cSetting_state) - 1, + EditorDrag(G, nullptr, -1, mode, SettingGetGlobal_i(G, cSetting_state) - 1, v1, v2, v3); } I->LastX = x; @@ -1525,7 +1525,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) vScale = SceneGetExactScreenVertexScale(G, v1); if (stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } /* transform into model coodinate space */ @@ -1566,7 +1566,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) vScale = SceneGetExactScreenVertexScale(G, v1); if (stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } switch (mode) { @@ -1651,7 +1651,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) vScale = SceneGetExactScreenVertexScale(G, v1); if (stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } v2[0] = (x - I->LastX) * vScale; @@ -1675,7 +1675,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) /* scale properly given the current projection matrix */ vScale = SceneGetExactScreenVertexScale(G, v1); if (stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } switch (mode) { @@ -1726,7 +1726,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) vScale = SceneGetExactScreenVertexScale(G, glm::value_ptr(I->m_view.origin())); if (stereo_via_adjacent_array(I->StereoMode)) { - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } v2[0] = (x - I->LastX) * vScale; @@ -1747,7 +1747,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) moved_flag = true; } - EditorFavorOrigin(G, NULL); + EditorFavorOrigin(G, nullptr); if (moved_flag && SettingGetGlobal_b(G, cSetting_roving_origin)) { SceneGetCenter(G, v2); /* gets position of center of screen */ SceneOriginSet(G, v2, true); @@ -1769,11 +1769,11 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) SceneNoteMouseInteraction(G); virtual_trackball = - SettingGet_i(G, NULL, NULL, cSetting_virtual_trackball); + SettingGet_i(G, nullptr, nullptr, cSetting_virtual_trackball); eff_width = I->Width; if (stereo_via_adjacent_array(I->StereoMode)) { eff_width = I->Width / 2; - x = get_stereo_x(x, &I->LastX, I->Width, NULL); + x = get_stereo_x(x, &I->LastX, I->Width, nullptr); } if (virtual_trackball == 2 && (!I->prev_no_z_rotation1 || !I->prev_no_z_rotation2)) { @@ -1805,7 +1805,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) { short r1lt, r2lt; - if (SettingGet_i(G, NULL, NULL, cSetting_virtual_trackball) == 2) { + if (SettingGet_i(G, nullptr, nullptr, cSetting_virtual_trackball) == 2) { r1lt = I->prev_no_z_rotation1; r2lt = I->prev_no_z_rotation2; } else { @@ -1835,13 +1835,13 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) normalize23f(v2, n2); cross_product3f(n1, n2, cp); theta = - (float) (SettingGet_f(G, NULL, NULL, cSetting_mouse_scale) * 2 * 180 * + (float) (SettingGet_f(G, nullptr, nullptr, cSetting_mouse_scale) * 2 * 180 * asin(sqrt1f(cp[0] * cp[0] + cp[1] * cp[1] + cp[2] * cp[2])) / cPI); dx = (v1[0] - v2[0]); dy = (v1[1] - v2[1]); - dt = (float) (SettingGet_f(G, NULL, NULL, cSetting_mouse_limit) * + dt = (float) (SettingGet_f(G, nullptr, nullptr, cSetting_mouse_limit) * sqrt1f(dx * dx + dy * dy) / scale); if (theta > dt) theta = dt; @@ -1976,7 +1976,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) pos[1] += (float) dy * ms; SettingSet_3fv(G->Setting, which_light, pos); - SettingGenerateSideEffects(G, which_light, NULL, 0, 1); + SettingGenerateSideEffects(G, which_light, nullptr, 0, 1); I->LastX = x; I->LastY = y; } break; @@ -2009,7 +2009,7 @@ void SceneDrag(Block* block, int x, int y, int mod, double when) } copy3f(SettingGet(G, which_light), pos); - SettingGenerateSideEffects(G, which_light, NULL, 0, 1); + SettingGenerateSideEffects(G, which_light, nullptr, 0, 1); pos[2] -= factor * ms; diff --git a/layer1/ScenePicking.cpp b/layer1/ScenePicking.cpp index 3c03959b8..3cd559897 100644 --- a/layer1/ScenePicking.cpp +++ b/layer1/ScenePicking.cpp @@ -27,13 +27,13 @@ int SceneDoXYPick(PyMOLGlobals * G, int x, int y, ClickSide click_side) } SceneDontCopyNext(G); - I->LastPicked.context.object = NULL; + I->LastPicked.context.object = nullptr; SceneRenderInfo renderInfo{}; renderInfo.pick = &I->LastPicked; renderInfo.mousePos = Offset2D{x, y}; renderInfo.clickSide = click_side; SceneRender(G, renderInfo); - return (I->LastPicked.context.object != NULL); + return (I->LastPicked.context.object != nullptr); /* did we pick something? */ } @@ -124,7 +124,7 @@ static std::vector SceneGetPickIndices(PyMOLGlobals* G, GridSetViewport(G, &I->grid, slot); } SceneRenderAll( - G, context, NULL, &pickmgr, RenderPass::Antialias, true, 0.0F, &I->grid, 0, SceneRenderWhich::AllObjects); + G, context, nullptr, &pickmgr, RenderPass::Antialias, true, 0.0F, &I->grid, 0, SceneRenderWhich::AllObjects); } } @@ -218,11 +218,11 @@ static void SceneRenderPickingSinglePick(PyMOLGlobals* G, " SceneClick-Detail: obj %p index %d bond %d\n", pick->context.object, pick->src.index, pick->src.bond ENDFB(G); } - // if cPickableNoPick then set object to NULL since nothing picked + // if cPickableNoPick then set object to nullptr since nothing picked if (pick->src.bond == cPickableNoPick) - pick->context.object = NULL; + pick->context.object = nullptr; } else { - pick->context.object = NULL; + pick->context.object = nullptr; } #ifndef PURE_OPENGL_ES_2 diff --git a/layer1/SceneRay.cpp b/layer1/SceneRay.cpp index 857067caa..e81bd441a 100644 --- a/layer1/SceneRay.cpp +++ b/layer1/SceneRay.cpp @@ -97,13 +97,13 @@ bool SceneRay(PyMOLGlobals * G, #else CScene *I = G->Scene; - CRay *ray = NULL; + CRay *ray = nullptr; float height, width; float aspRat; float rayView[16]; double timing; - char *charVLA = NULL; - char *headerVLA = NULL; + char *charVLA = nullptr; + char *headerVLA = nullptr; float fov; int stereo_hand = 0; auto grid_mode = SettingGet(G, cSetting_grid_mode); @@ -270,7 +270,7 @@ bool SceneRay(PyMOLGlobals * G, RenderInfo info; info.ray = ray; info.ortho = ortho; - info.vertex_scale = SceneGetScreenVertexScale(G, NULL); + info.vertex_scale = SceneGetScreenVertexScale(G, nullptr); info.use_shaders = SettingGetGlobal_b(G, cSetting_use_shaders); if(SettingGetGlobal_b(G, cSetting_dynamic_width)) { @@ -282,7 +282,7 @@ bool SceneRay(PyMOLGlobals * G, } for (auto* obj : I->Obj) { - // ObjectGroup used to have fRender = NULL + // ObjectGroup used to have fRender = nullptr if (obj->type != cObjectGroup) { if(SceneGetDrawFlag(&I->grid, slot_vla, obj->grid_slot)) { float color[3]; @@ -394,7 +394,7 @@ bool SceneRay(PyMOLGlobals * G, RayRenderPOV(ray, ray_width, ray_height, &headerVLA, &charVLA, I->m_view.m_clipSafe().m_front, I->m_view.m_clipSafe().m_back, fov, angle, antialias); if(!(charVLA_ptr && headerVLA_ptr)) { /* immediate mode */ - strcpy(prefix, SettingGet_s(G, NULL, NULL, cSetting_batch_prefix)); + strcpy(prefix, SettingGet_s(G, nullptr, nullptr, cSetting_batch_prefix)); #ifndef _PYMOL_NOPY if(PPovrayRender(G, headerVLA, charVLA, prefix, ray_width, ray_height, antialias)) { @@ -791,7 +791,7 @@ void SceneRenderRayVolume(PyMOLGlobals * G, CScene *I){ glDrawPixels(rayVolumeImage->getWidth(), rayVolumeImage->getHeight(), GL_RGBA, GL_UNSIGNED_BYTE, rayVolumeImage->bits()); } else { - SceneDrawImageOverlay(G, 1, NULL); + SceneDrawImageOverlay(G, 1, nullptr); } } #endif diff --git a/layer1/SceneRender.cpp b/layer1/SceneRender.cpp index ee9f65e8c..94aec2f51 100644 --- a/layer1/SceneRender.cpp +++ b/layer1/SceneRender.cpp @@ -243,7 +243,7 @@ void SceneRender(PyMOLGlobals* G, const SceneRenderInfo& renderInfo) (stereo && stereo_mode != 0); // are we doing stereo? if (!must_render_stereo) { if (G->StereoCapable && - SettingGet(G, NULL, NULL, cSetting_stereo_double_pump_mono)) { + SettingGet(G, nullptr, nullptr, cSetting_stereo_double_pump_mono)) { /* force stereo rendering */ must_render_stereo = true; stereo_double_pump_mono = true; @@ -368,7 +368,7 @@ void SceneRender(PyMOLGlobals* G, const SceneRenderInfo& renderInfo) /* make note of how large pixels are at the origin */ - I->VertexScale = SceneGetScreenVertexScale(G, NULL); + I->VertexScale = SceneGetScreenVertexScale(G, nullptr); /* determine the direction in which we are looking relative */ @@ -596,7 +596,7 @@ void SceneRenderAA(PyMOLGlobals* G) GL_FRAMEBUFFER_EXT, G->ShaderMgr->default_framebuffer_id); if (!I->offscreenCGO) { CGO* unitCGO = GenerateUnitScreenCGO(G); - ok &= unitCGO != NULL; + ok &= unitCGO != nullptr; if (ok) { auto antialias_mode = SettingGet(G, cSetting_antialias_shader); @@ -629,11 +629,11 @@ void SceneRenderAA(PyMOLGlobals* G) CGOFreeWithoutVBOs(unitCGO); I->offscreenCGO->use_shader = true; } else { - I->offscreenCGO = NULL; + I->offscreenCGO = nullptr; } } if (ok && I->offscreenCGO) { - CGORender(I->offscreenCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(I->offscreenCGO, nullptr, nullptr, nullptr, nullptr, nullptr); G->ShaderMgr->Disable_Current_Shader(); glBindTexture(GL_TEXTURE_2D, 0); glEnable(GL_DEPTH_TEST); @@ -846,7 +846,7 @@ void SceneRenderAll(PyMOLGlobals* G, SceneUnitContext* context, float* normal, break; case SceneRenderWhich::OnlyNonGadgets: for (auto obj : I->NonGadgetObjs) { - // ObjectGroup used to have fRender = NULL + // ObjectGroup used to have fRender = nullptr if (obj->type != cObjectGroup) { SceneRenderAllObject( G, I, context, &info, normal, state, obj, grid, slot_vla, fat); @@ -858,7 +858,7 @@ void SceneRenderAll(PyMOLGlobals* G, SceneUnitContext* context, float* normal, for (auto obj : I->NonGadgetObjs) { /* EXPERIMENTAL RAY-VOLUME COMPOSITION CODE */ if (obj->type != - cObjectGroup && // ObjectGroup used to have fRender = NULL + cObjectGroup && // ObjectGroup used to have fRender = nullptr (!rayVolume || obj->type == cObjectVolume)) { SceneRenderAllObject( G, I, context, &info, normal, state, obj, grid, slot_vla, fat); @@ -965,7 +965,7 @@ static void DoRendering(PyMOLGlobals* G, CScene* I, GridInfo* grid, int times, #ifdef PURE_OPENGL_ES_2 if (!onlySelections) { EditorRender(G, curState); - CGORender(G->DebugCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(G->DebugCGO, nullptr, nullptr, nullptr, nullptr, nullptr); } #else if (!use_shaders) @@ -979,7 +979,7 @@ static void DoRendering(PyMOLGlobals* G, CScene* I, GridInfo* grid, int times, if (!onlySelections) { if (!use_shaders) glNormal3fv(normal); - CGORender(G->DebugCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(G->DebugCGO, nullptr, nullptr, nullptr, nullptr, nullptr); } if (!use_shaders) { glPopMatrix(); /* 1 */ @@ -994,7 +994,7 @@ static void DoRendering(PyMOLGlobals* G, CScene* I, GridInfo* grid, int times, EditorRender(G, curState); } // transparency-mode == 3 render all objects for this pass - SceneRenderAll(G, context, normal, NULL, pass, false, width_scale, + SceneRenderAll(G, context, normal, nullptr, pass, false, width_scale, grid, times, SceneRenderWhich::OnlyNonGadgets); // opaque } else { #else @@ -1004,7 +1004,7 @@ static void DoRendering(PyMOLGlobals* G, CScene* I, GridInfo* grid, int times, for (const auto pass2 : passes) { /* render opaque, then antialiased, then transparent... */ - SceneRenderAll(G, context, normal, NULL, pass2, false, + SceneRenderAll(G, context, normal, nullptr, pass2, false, width_scale, grid, times, SceneRenderWhich::GadgetsLast); } cont = false; @@ -1015,7 +1015,7 @@ static void DoRendering(PyMOLGlobals* G, CScene* I, GridInfo* grid, int times, // background glBlendFunc_default(); - SceneRenderAll(G, context, normal, NULL, + SceneRenderAll(G, context, normal, nullptr, RenderPass::Transparent /* gadgets render in transp pass */, false, width_scale, grid, times, SceneRenderWhich::OnlyGadgets); glDisable(GL_BLEND); @@ -1074,7 +1074,7 @@ static void DoRendering(PyMOLGlobals* G, CScene* I, GridInfo* grid, int times, GL_DEFAULT_SHADER_WITH_SETTINGS, GL_OIT_COPY_SHADER); I->offscreenOIT_CGO_copy->use_shader = true; } - CGORender(I->offscreenOIT_CGO_copy, NULL, NULL, NULL, NULL, NULL); + CGORender(I->offscreenOIT_CGO_copy, nullptr, nullptr, nullptr, nullptr, nullptr); } if (!I->offscreenOIT_CGO) { I->offscreenOIT_CGO = GenerateUnitScreenCGO(G); @@ -1082,14 +1082,14 @@ static void DoRendering(PyMOLGlobals* G, CScene* I, GridInfo* grid, int times, GL_DEFAULT_SHADER_WITH_SETTINGS, GL_OIT_SHADER); I->offscreenOIT_CGO->use_shader = true; } - CGORender(I->offscreenOIT_CGO, NULL, NULL, NULL, NULL, NULL); + CGORender(I->offscreenOIT_CGO, nullptr, nullptr, nullptr, nullptr, nullptr); glBlendFunc_default(); if ((currentFrameBuffer == G->ShaderMgr->default_framebuffer_id) && t_mode_3) { // onlySelections and t_mode_3, render only gadgets - SceneRenderAll(G, context, normal, NULL, + SceneRenderAll(G, context, normal, nullptr, RenderPass::Transparent /* gadgets render in transp pass */, false, width_scale, grid, times, SceneRenderWhich::OnlyGadgets); } diff --git a/layer1/Seq.cpp b/layer1/Seq.cpp index c16c03394..99188279d 100644 --- a/layer1/Seq.cpp +++ b/layer1/Seq.cpp @@ -333,7 +333,7 @@ void CSeq::draw(CGO* orthoCGO) } fill_color = ColorGet(G, fill_color_index); if(unaligned_color_index < 0) { - unaligned_color = NULL; + unaligned_color = nullptr; } else { unaligned_color = ColorGet(G, unaligned_color_index); } diff --git a/layer1/Setting.cpp b/layer1/Setting.cpp index bd3382f32..7986a2f03 100644 --- a/layer1/Setting.cpp +++ b/layer1/Setting.cpp @@ -187,12 +187,12 @@ SettingUniqueEntry *SettingFindSettingUniqueEntry(PyMOLGlobals * G, int unique_i } } } - return NULL; + return nullptr; } int SettingUniqueCheck(PyMOLGlobals * G, int unique_id, int setting_id) { - return SettingFindSettingUniqueEntry(G, unique_id, setting_id) != NULL; + return SettingFindSettingUniqueEntry(G, unique_id, setting_id) != nullptr; } /** @@ -283,7 +283,7 @@ PyObject *SettingUniqueGetPyObject(PyMOLGlobals * G, int unique_id, int index) } } - return NULL; + return nullptr; } static int SettingUniqueEntry_IsSame(SettingUniqueEntry *entry, int setting_type, const void *value){ @@ -359,7 +359,7 @@ bool SettingUniqueUnset(PyMOLGlobals * G, int unique_id, int setting_id) int SettingUniqueSetTypedValue(PyMOLGlobals * G, int unique_id, int setting_id, int setting_type, const void *value) -/* set value to NULL in order to delete setting */ +/* set value to nullptr in order to delete setting */ { CSettingUnique *I = G->SettingUnique; int isset = false; @@ -793,7 +793,7 @@ PyObject *SettingUniqueAsPyList(PyMOLGlobals * G) { assert(PyGILState_Check()); - PyObject *result = NULL; + PyObject *result = nullptr; CSettingUnique *I = G->SettingUnique; { auto n_entry = I->id2offset.size(); @@ -801,7 +801,7 @@ PyObject *SettingUniqueAsPyList(PyMOLGlobals * G) if(result) { n_entry = 0; for (auto id2offset : I->id2offset) { - PyObject *setting_list = NULL; + PyObject *setting_list = nullptr; auto unique_id = id2offset.first; auto offset = id2offset.second; { @@ -908,7 +908,7 @@ PyObject *SettingGetGlobalsAsPyList(PyMOLGlobals * G) { assert(PyGILState_Check()); - PyObject *result = NULL; + PyObject *result = nullptr; CSetting *I = G->Setting; result = SettingAsPyList(I); return (PConvAutoNone(result)); @@ -921,11 +921,11 @@ static PyObject *get_list(CSetting * I, int index, bool incl_blacklisted) { assert(PyGILState_Check()); - PyObject *result = NULL, *value = NULL; + PyObject *result = nullptr, *value = nullptr; int setting_type = SettingInfo[index].type; if (!incl_blacklisted && is_session_blacklisted(index)) { - return NULL; + return nullptr; } switch (setting_type) { @@ -963,7 +963,7 @@ PyObject *SettingAsPyList(CSetting * I, bool incl_blacklisted) { assert(PyGILState_Check()); - PyObject *result = NULL; + PyObject *result = nullptr; int a; if(I) { @@ -973,7 +973,7 @@ PyObject *SettingAsPyList(CSetting * I, bool incl_blacklisted) for(a = 0; a < cSetting_INIT; a++) { if(I->info[a].defined) { PyObject * item = get_list(I, a, incl_blacklisted); - if (item != NULL) { + if (item != nullptr) { list.push_back(item); } } @@ -1020,7 +1020,7 @@ static int set_list(CSetting * I, PyObject * list) const char * val_s; }; - if (list == NULL || CPythonVal_IsNone(list)) + if (list == nullptr || CPythonVal_IsNone(list)) return true; ok_assert(1, PyList_Check(list)); @@ -1074,9 +1074,9 @@ CSetting *SettingNewFromPyList(PyMOLGlobals * G, PyObject * list) int ok = true; ov_size size; ov_size a; - CSetting *I = NULL; + CSetting *I = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) { @@ -1103,7 +1103,7 @@ int SettingFromPyList(CSetting * I, PyObject * list) ov_size a; if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) ok = PyList_Check(list); if(ok) { @@ -1121,7 +1121,7 @@ int SettingFromPyList(CSetting * I, PyObject * list) * Get the indices of all settings that have changed since last calling * this function. Resets the "changed" flag. * - * @param name object name or NULL/"" for global settings + * @param name object name or nullptr/"" for global settings * @param state object state */ std::vector SettingGetUpdateList(PyMOLGlobals * G, const char * name, int state) @@ -1190,7 +1190,7 @@ const char * SettingGetTextPtr(PyMOLGlobals * G, const CSetting * set1, const CS int index, char *buffer) { int type; - const char *sptr = NULL; + const char *sptr = nullptr; const float *ptr; type = SettingGetType(G, index); switch (type) { @@ -1237,7 +1237,7 @@ const char * SettingGetTextPtr(PyMOLGlobals * G, const CSetting * set1, const CS case cSetting_string: return SettingGet_s(G, set1, set2, index); default: - return NULL; + return nullptr; } return buffer; } @@ -1412,7 +1412,7 @@ PyObject *SettingGetPyObject(PyMOLGlobals * G, const CSetting * set1, const CSet { assert(PyGILState_Check()); - PyObject *result = NULL; + PyObject *result = nullptr; const float *ptr; int type = SettingGetType(G, index); @@ -1455,7 +1455,7 @@ PyObject *SettingGetTuple(PyMOLGlobals * G, const CSetting * set1, const CSettin { assert(PyGILState_Check()); - PyObject *result = NULL; + PyObject *result = nullptr; const float *ptr; int type = SettingGetType(G, index); @@ -1682,7 +1682,7 @@ const char * _SettingGet(int index, const CSetting * I) default: PRINTFB(G, FB_Setting, FB_Errors) "Setting-Error: type read mismatch (string) %d\n", index ENDFB(G); - result = NULL; + result = nullptr; } return (char*) result; } @@ -1696,7 +1696,7 @@ const float * _SettingGet(int index, const CSetting * I) PyMOLGlobals *G = I->G; PRINTFB(G, FB_Setting, FB_Errors) " Setting-Error: type read mismatch (float3) %d\n", index ENDFB(G); - return NULL; + return nullptr; } return I->info[index].float3_; } @@ -2771,7 +2771,7 @@ void SettingGenerateSideEffects(PyMOLGlobals * G, int index, const char *sele, i case cSetting_bg_rgb_bottom: { /* clamp this value */ - const char * bg_image_filename = SettingGet_s(G, NULL, NULL, cSetting_bg_image_filename); + const char * bg_image_filename = SettingGet_s(G, nullptr, nullptr, cSetting_bg_image_filename); if(!(bg_image_filename && bg_image_filename[0]) && SettingGetGlobal_b(G, cSetting_bg_gradient) && !OrthoBackgroundDataIsSet(*G->Ortho)) { ColorUpdateFrontFromSettings(G); @@ -2784,9 +2784,9 @@ void SettingGenerateSideEffects(PyMOLGlobals * G, int index, const char *sele, i case cSetting_bg_rgb: { /* clamp this value */ - const float *v = ColorGet(G, SettingGet_color(G, NULL, NULL, cSetting_bg_rgb)); + const float *v = ColorGet(G, SettingGet_color(G, nullptr, nullptr, cSetting_bg_rgb)); { - const char * bg_image_filename = SettingGet_s(G, NULL, NULL, cSetting_bg_image_filename); + const char * bg_image_filename = SettingGet_s(G, nullptr, nullptr, cSetting_bg_image_filename); if(!(bg_image_filename && bg_image_filename[0]) && !OrthoBackgroundDataIsSet(*G->Ortho)) { ColorUpdateFront(G, v); ExecutiveInvalidateRep(G, inv_sele, cRepAll, cRepInvColor); @@ -2955,7 +2955,7 @@ void SettingGenerateSideEffects(PyMOLGlobals * G, int index, const char *sele, i int scaleFactor = SettingGetGlobal_i(G, cSetting_display_scale_factor); if (scaleFactor > 0) { _gScaleFactor = scaleFactor; - ExecutiveInvalidateRep(G, NULL, cRepLabel, cRepInvRep); + ExecutiveInvalidateRep(G, nullptr, cRepLabel, cRepInvRep); OrthoCommandIn(G, "viewport"); } else { SettingSetGlobal_i(G, cSetting_display_scale_factor, 1); @@ -3127,8 +3127,8 @@ int SettingCheckFontID(PyMOLGlobals * G, CSetting * set1, CSetting * set2, int f PRINTFB(G, FB_Setting, FB_Warnings) "RepLabel-Warning: GLUT labels (label_font_id 0-4) are no longer available for labelling\n the scene since they are not resizeable label_font_id=%d setting back to 5 (default) \n", font_id ENDFB(G); - if (SettingGet_i(G, set1, NULL, cSetting_label_font_id) == font_id && SettingSet_i(set1, cSetting_label_font_id, 5)){ - } else if (SettingGet_i(G, set2, NULL, cSetting_label_font_id) == font_id && SettingSet_i(set2, cSetting_label_font_id, 5)){ + if (SettingGet_i(G, set1, nullptr, cSetting_label_font_id) == font_id && SettingSet_i(set1, cSetting_label_font_id, 5)){ + } else if (SettingGet_i(G, set2, nullptr, cSetting_label_font_id) == font_id && SettingSet_i(set2, cSetting_label_font_id, 5)){ } else if (SettingGetGlobal_i(G, cSetting_label_font_id) == font_id){ SettingSetGlobal_i(G, cSetting_label_font_id, 5); }; @@ -3140,14 +3140,14 @@ int SettingCheckFontID(PyMOLGlobals * G, CSetting * set1, CSetting * set2, int f /** * State index iterator constructor, see Setting.h for documentation. * - * @param set Optional object settings (can be NULL) + * @param set Optional object settings (can be nullptr) * @param nstate Maximum number of states */ StateIterator::StateIterator( PyMOLGlobals* G, CSetting* set, StateIndex_t state_, int nstate) { if (state_ == cStateCurrent) { - state_ = SettingGet_i(G, set, NULL, cSetting_state) - 1; + state_ = SettingGet_i(G, set, nullptr, cSetting_state) - 1; } if (state_ == cStateAll) { @@ -3156,7 +3156,7 @@ StateIterator::StateIterator( } else { // given state or static singleton state = (state_ > 0 && nstate == 1 - && SettingGet_b(G, set, NULL, cSetting_static_singletons)) ? 0 : state_; + && SettingGet_b(G, set, nullptr, cSetting_static_singletons)) ? 0 : state_; end = state + 1; } diff --git a/layer1/Setting.h b/layer1/Setting.h index d5972c665..331334cdf 100644 --- a/layer1/Setting.h +++ b/layer1/Setting.h @@ -105,7 +105,7 @@ struct SettingRec { void delete_s() { if (str_) { delete str_; - str_ = NULL; + str_ = nullptr; } } }; diff --git a/layer1/Symmetry.cpp b/layer1/Symmetry.cpp index 25194dac0..b614ab2c0 100644 --- a/layer1/Symmetry.cpp +++ b/layer1/Symmetry.cpp @@ -29,7 +29,7 @@ Z* ------------------------------------------------------------------- PyObject *SymmetryAsPyList(CSymmetry * I) { - PyObject *result = NULL; + PyObject *result = nullptr; if(I) { result = PyList_New(2); @@ -47,9 +47,9 @@ static int SymmetryFromPyList(CSymmetry * I, PyObject * list) PyObject *secondval; if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -81,12 +81,12 @@ static int SymmetryFromPyList(CSymmetry * I, PyObject * list) CSymmetry *SymmetryNewFromPyList(PyMOLGlobals * G, PyObject * list) { - CSymmetry *I = NULL; + CSymmetry *I = nullptr; I = new CSymmetry(G); if(I) { if(!SymmetryFromPyList(I, list)) { delete I; - I = NULL; + I = nullptr; } } return (I); diff --git a/layer1/Text.cpp b/layer1/Text.cpp index fd31175e0..8513c5b05 100644 --- a/layer1/Text.cpp +++ b/layer1/Text.cpp @@ -404,13 +404,13 @@ void TextDrawStrAt(PyMOLGlobals * G, const char *st, int x, int y , CGO *orthoCG { CText *I = G->Text; TextSetPos3f(G, (float) x, (float) y, 0.0F); - TextRenderOpenGL(G, NULL, I->Default_ID, st, TEXT_DEFAULT_SIZE, NULL, false, 0, 1, orthoCGO); + TextRenderOpenGL(G, nullptr, I->Default_ID, st, TEXT_DEFAULT_SIZE, nullptr, false, 0, 1, orthoCGO); } void TextDrawStr(PyMOLGlobals * G, const char *st , CGO *orthoCGO) { CText *I = G->Text; - TextRenderOpenGL(G, NULL, I->Default_ID, st, TEXT_DEFAULT_SIZE, NULL, false, 0, 1, orthoCGO); + TextRenderOpenGL(G, nullptr, I->Default_ID, st, TEXT_DEFAULT_SIZE, nullptr, false, 0, 1, orthoCGO); } void TextDrawChar(PyMOLGlobals * G, char ch , CGO *orthoCGO) @@ -418,7 +418,7 @@ void TextDrawChar(PyMOLGlobals * G, char ch , CGO *orthoCGO) char st[2] = { 0, 0 }; CText *I = G->Text; st[0] = ch; - TextRenderOpenGL(G, NULL, I->Default_ID, st, TEXT_DEFAULT_SIZE, NULL, false, 0, 1, orthoCGO); + TextRenderOpenGL(G, nullptr, I->Default_ID, st, TEXT_DEFAULT_SIZE, nullptr, false, 0, 1, orthoCGO); } const char *TextRenderRay(PyMOLGlobals * G, CRay * ray, int text_id, diff --git a/layer1/TypeFace.cpp b/layer1/TypeFace.cpp index 97a95f473..750cdd415 100644 --- a/layer1/TypeFace.cpp +++ b/layer1/TypeFace.cpp @@ -162,7 +162,7 @@ float TypeFaceGetKerning(CTypeFace * I, CTypeFace *TypeFaceLoad(PyMOLGlobals * G, unsigned char *dat, unsigned int len) { - return NULL; + return nullptr; } void TypeFaceFree(CTypeFace * face) diff --git a/layer1/View.cpp b/layer1/View.cpp index 1b0d3b16f..9330494cd 100644 --- a/layer1/View.cpp +++ b/layer1/View.cpp @@ -340,9 +340,9 @@ void ViewElemArrayPurge(PyMOLGlobals * G, CViewElem * view, int nFrame) PyObject *ViewElemAsPyList(PyMOLGlobals * G, const CViewElem * view) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(21); @@ -433,7 +433,7 @@ int ViewElemFromPyList(PyMOLGlobals * G, PyObject * list, CViewElem * view) ov_size ll = 0; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -483,7 +483,7 @@ int ViewElemFromPyList(PyMOLGlobals * G, PyObject * list, CViewElem * view) if(ok) ok = PConvPyIntToInt(PyList_GetItem(list, 13), &view->scene_flag); if(ok && view->scene_flag) { - const char *ptr = NULL; + const char *ptr = nullptr; view->scene_flag = false; if(PConvPyStrToStrPtr(PyList_GetItem(list, 14), &ptr)) { OVreturn_word result = OVLexicon_GetFromCString(G->Lexicon, ptr); @@ -525,15 +525,15 @@ int ViewElemVLAFromPyList(PyMOLGlobals * G, PyObject * list, CViewElem ** vla_pt int nFrame) { int ok = true; - CViewElem *vla = NULL; + CViewElem *vla = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) ok = (PyList_Size(list) == nFrame); if(ok) - ok = ((vla = VLACalloc(CViewElem, nFrame)) != NULL); + ok = ((vla = VLACalloc(CViewElem, nFrame)) != nullptr); if(ok) { int a; for(a = 0; a < nFrame; a++) { @@ -553,10 +553,10 @@ int ViewElemVLAFromPyList(PyMOLGlobals * G, PyObject * list, CViewElem ** vla_pt PyObject *ViewElemVLAAsPyList(PyMOLGlobals * G, const CViewElem * vla, int nFrame) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(nFrame); for(a = 0; a < nFrame; a++) { @@ -587,7 +587,7 @@ CViewIterator ViewGetIterator(CView * I) int ViewIterate(CView * I, CViewIterator * iter, CRay * ray, int at_least_once) { int result; - CViewElem *elem = NULL; + CViewElem *elem = nullptr; if((!I) || (!I->NView)) { /* trusting short-circuit to avoid segfault */ if(at_least_once) { diff --git a/layer1/Wizard.cpp b/layer1/Wizard.cpp index 9fbb9a411..6b5347ef1 100644 --- a/layer1/Wizard.cpp +++ b/layer1/Wizard.cpp @@ -195,7 +195,7 @@ void WizardRefresh(PyMOLGlobals * G) { CWizard *I = G->Wizard; - char *vla = NULL; + char *vla = nullptr; pymol::pautoblock block(G); /* get the current prompt */ @@ -495,7 +495,7 @@ int CWizard::click(int button, int x, int y, int mod) { pymol::pblock block(G); auto wiz = WizardGet(G); - PyObject* menuList = NULL; + PyObject* menuList = nullptr; if (wiz) { menuList = WizardCallPython(G, wiz, "get_menu", PyObject_CallMethod, "s", I->Line[a].code); } @@ -503,7 +503,7 @@ int CWizard::click(int button, int x, int y, int mod) if(menuList && (menuList != Py_None)) { int my = rect.top - (cWizardTopMargin + a * LineHeight) - 2; - PopUpNew(G, x, my, x, y, false, menuList, NULL); + PopUpNew(G, x, my, x, y, false, menuList, nullptr); } Py_XDECREF(menuList); } diff --git a/layer2/AtomInfo.cpp b/layer2/AtomInfo.cpp index b13beb97d..0005a531f 100644 --- a/layer2/AtomInfo.cpp +++ b/layer2/AtomInfo.cpp @@ -71,7 +71,7 @@ void AtomInfoCleanAtomName(char *name) #ifndef _PYMOL_NOPY int AtomInfoSetSettingFromPyObject(PyMOLGlobals * G, AtomInfoType *ai, int setting_id, PyObject * val){ if (val == Py_None) - val = NULL; + val = nullptr; if (!val) { if (!ai->has_setting) @@ -89,7 +89,7 @@ PyObject *SettingGetIfDefinedPyObject(PyMOLGlobals * G, AtomInfoType * ai, int s if(ai->has_setting) { return SettingUniqueGetPyObject(G, ai->unique_id, setting_id); } - return NULL; + return nullptr; } int AtomInfoReserveUniqueID(PyMOLGlobals* G, int unique_id) @@ -791,7 +791,7 @@ bool AtomResiFromResv(char *resi, size_t size, int resv, char inscode) { /*========================================================================*/ PyObject *AtomInfoAsPyList(PyMOLGlobals * G, const AtomInfoType * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(48); @@ -1017,7 +1017,7 @@ void AtomInfoCopy(PyMOLGlobals * G, const AtomInfoType * src, AtomInfoType * dst #ifdef _PYMOL_IP_EXTRAS #endif if (src->anisou) { - dst->anisou = NULL; + dst->anisou = nullptr; memcpy(dst->get_anisou(), src->anisou, 6 * sizeof(float)); } } @@ -1128,7 +1128,7 @@ void AtomInfoCombine(PyMOLGlobals * G, AtomInfoType * dst, AtomInfoType&& src_, * @param atInfo0 List of reference atoms * @param n0 Size of atInfo0 list * @param atInfo1 List of atoms which need to be made unique - * @param flag1 Optional whitelist mask for `atInfo1` or NULL + * @param flag1 Optional whitelist mask for `atInfo1` or nullptr * @param n1 Size of atInfo1 list * @param mol Optional reference molecule to limit to atoms with coordinates * @return Number of renamed atoms @@ -1151,8 +1151,8 @@ int AtomInfoUniquefyNames(PyMOLGlobals * G, const AtomInfoType * atInfo0, int n0 WordType name; ai1 = atInfo1; - lai0 = NULL; /* last atom compared against in each object */ - lai1 = NULL; + lai0 = nullptr; /* last atom compared against in each object */ + lai1 = nullptr; st0 = 0; nd0 = 0; st1 = 0; @@ -1869,7 +1869,7 @@ const ElementTableItemType ElementTable[] = { {"livermorium", "Lv", 1.80, 293.000000}, {"tennessine", "Ts", 1.80, 294.000000}, {"oganesson", "Og", 1.80, 294.000000}, - {NULL, NULL, 0.00, 0.000000} + {NULL, nullptr, 0.00, 0.000000} }; const int ElementTableSize = sizeof(ElementTable) / sizeof(ElementTable[0]) - 1; @@ -2349,8 +2349,8 @@ static void set_protons(PyMOLGlobals * G, AtomInfoType * I) */ void AtomInfoAssignParameters(PyMOLGlobals * G, AtomInfoType * I) { - const char *n = NULL; - char *e = NULL; + const char *n = nullptr; + char *e = nullptr; int pri; e = I->elem; diff --git a/layer2/AtomInfoHistory.h b/layer2/AtomInfoHistory.h index 45b61cb0c..36f717c9f 100644 --- a/layer2/AtomInfoHistory.h +++ b/layer2/AtomInfoHistory.h @@ -163,8 +163,8 @@ typedef struct AtomInfoType_1_7_7 { // no anisou support in 1.8.0 bool has_anisou() const { return false; } - const float * get_anisou() const { return NULL; } - float * get_anisou() { return NULL; } + const float * get_anisou() const { return nullptr; } + float * get_anisou() { return nullptr; } inline void setResi(int resv_, char inscode_) { resv = resv_; diff --git a/layer2/CifBondDict.h b/layer2/CifBondDict.h index beee39948..ffecddc37 100644 --- a/layer2/CifBondDict.h +++ b/layer2/CifBondDict.h @@ -154,7 +154,7 @@ class bond_dict_t { const res_bond_dict_t * get(const char * resn) const { auto it = m_data.find(resn); if (it == m_data.end()) - return NULL; + return nullptr; return &it->second; } diff --git a/layer2/CifFile.cpp b/layer2/CifFile.cpp index 4ef48e5f9..3e3a0234d 100644 --- a/layer2/CifFile.cpp +++ b/layer2/CifFile.cpp @@ -116,7 +116,7 @@ class cif_loop { const char * get_value_raw(int row, int col) const; }; -// get table value, return NULL if indices out of bounds +// get table value, return nullptr if indices out of bounds const char * cif_loop::get_value_raw(int row, int col) const { if (row >= nrows) return nullptr; @@ -128,7 +128,7 @@ unsigned cif_array::size() const { return (col == NOT_IN_LOOP) ? 1 : pointer.loop->nrows; } -/// Get array value, return NULL if `pos >= size()` or value in ['.', '?'] +/// Get array value, return nullptr if `pos >= size()` or value in ['.', '?'] const char* cif_array::get_value_raw(unsigned pos) const { if (col == NOT_IN_LOOP) @@ -147,7 +147,7 @@ bool cif_array::is_missing_all() const { } /** - * Get a pointer to array or NULL if not found + * Get a pointer to array or nullptr if not found * * Can lookup different aliases, the first one found is returned. * Also supports an alias shortcut for the trivial case where mmCIF uses @@ -260,7 +260,7 @@ bool cif_file::parse(char*&& p) { if (*p == '#') { while (!(islinefeed0(*++p))); prev = *p; - } else if (isquote(*p)) { // will NULL the closing quote + } else if (isquote(*p)) { // will nullptr the closing quote quote = *p; keypossible.push_back(false); tokens.push_back(p + 1); diff --git a/layer2/CifFile.h b/layer2/CifFile.h index cbd79976e..3d18784a2 100644 --- a/layer2/CifFile.h +++ b/layer2/CifFile.h @@ -61,7 +61,7 @@ class cif_array; // data_ const char* code = block->code(); - // get data item pointer, or NULL if name not found + // get data item pointer, or nullptr if name not found auto* dataitem1 = block->get_arr("_some.name1"); auto* dataitem2 = block->get_arr("_some.name2", "_alternate.name"); @@ -135,7 +135,7 @@ class cif_array { const char * value; } pointer; - // Raw data value or NULL for unknown/inapplicable and `pos >= size()` + // Raw data value or nullptr for unknown/inapplicable and `pos >= size()` const char* get_value_raw(unsigned pos = 0) const; // point this array to a loop (only for parsing) @@ -178,7 +178,7 @@ class cif_array { /** * Get element as null-terminated string. The default value is the empty - * string, unlike as() which returns NULL as the default value. + * string, unlike as() which returns nullptr as the default value. * If `pos >= size()` then return `d`. * @param pos element index (= row index in loop) * @param d default value for unknown/inapplicable elements @@ -233,10 +233,10 @@ class cif_data { cif_data& operator=(const cif_data&) = delete; cif_data& operator=(cif_data&&) = default; - /// Block code (never NULL) + /// Block code (never nullptr) const char* code() const { return m_code ? m_code : ""; } - // Get a pointer to array or NULL if not found + // Get a pointer to array or nullptr if not found const cif_array* get_arr(const char* key) const; template const cif_array* get_arr(const char* key, Args... aliases) const @@ -245,14 +245,14 @@ class cif_data { return arr ? arr : get_arr(aliases...); } - /// Like get_arr() but return a default value instead of NULL if not found + /// Like get_arr() but return a default value instead of nullptr if not found template const cif_array* get_opt(Args... keys) const { auto arr = get_arr(keys...); return arr ? arr : empty_array(); } - /// Get a pointer to a save frame or NULL if not found + /// Get a pointer to a save frame or nullptr if not found const cif_data* get_saveframe(const char* code) const; }; diff --git a/layer2/CifMoleculeReader.cpp b/layer2/CifMoleculeReader.cpp index 84194d5a4..29a303b06 100644 --- a/layer2/CifMoleculeReader.cpp +++ b/layer2/CifMoleculeReader.cpp @@ -63,7 +63,7 @@ const char * aa_three_letter[] = { "GLY", // G "HIS", // H "ILE", // I - NULL, // J + nullptr, // J "LYS", // K "LEU", // L "MET", // M @@ -74,10 +74,10 @@ const char * aa_three_letter[] = { "ARG", // R "SER", // S "THR", // T - NULL, // U + nullptr, // U "VAL", // V "TRP", // W - NULL, // X for other + nullptr, // X for other "TYR", // Y "GLX", // Z for ambiguous glutamine/glutamic acid }; @@ -214,7 +214,7 @@ static T VLAGetFirstNonNULL(T * vla) { for (int i = 0; i < n; ++i) if (vla[i]) return vla[i]; - return NULL; + return nullptr; } /** @@ -672,7 +672,7 @@ static oper_collection_t parse_oper_expression(const std::string &expr) { * Get chains which are part of the assembly * * assembly_chains: output set - * assembly_id: ID of the assembly or NULL to use first assembly + * assembly_id: ID of the assembly or nullptr to use first assembly */ static bool get_assembly_chains(PyMOLGlobals * G, const cif_data * data, @@ -1105,12 +1105,12 @@ static CoordSet** read_atom_site(PyMOLGlobals* G, const cif_data* data, arr_group_pdb = data->get_opt("_atom_site.group_pdb"); arr_alt = data->get_opt("_atom_site.label_alt_id"); arr_b = data->get_opt("_atom_site?b_iso_or_equiv"); - arr_u = data->get_arr("_atom_site?u_iso_or_equiv"); // NULL + arr_u = data->get_arr("_atom_site?u_iso_or_equiv"); // nullptr arr_q = data->get_opt("_atom_site?occupancy"); arr_ID = data->get_opt("_atom_site.id", "_atom_site_label"); arr_mod_num = data->get_opt("_atom_site.pdbx_pdb_model_num"); - arr_entity_id = data->get_arr("_atom_site.label_entity_id"); // NULL + arr_entity_id = data->get_arr("_atom_site.label_entity_id"); // nullptr const cif_array * arr_color = data->get_arr("_atom_site.pymol_color"); const cif_array * arr_reps = data->get_arr("_atom_site.pymol_reps"); @@ -2242,7 +2242,7 @@ static ObjectMolecule *ObjectMoleculeReadCifData(PyMOLGlobals * G, /** * Read one or multiple object-molecules from a CIF file. If there is only one * or multiplex=0, then return the object-molecule. Otherwise, create each - * object - named by its data block name - and return NULL. + * object - named by its data block name - and return nullptr. */ pymol::Result ObjectMoleculeReadCifStr(PyMOLGlobals * G, ObjectMolecule * I, const char *st, int frame, diff --git a/layer2/CoordSet.cpp b/layer2/CoordSet.cpp index 7eab88129..6c670f9ef 100644 --- a/layer2/CoordSet.cpp +++ b/layer2/CoordSet.cpp @@ -62,7 +62,7 @@ Z* ------------------------------------------------------------------- * * @param v_out Buffer for return value, may or may not be used. * @param inv If true, apply the inverse of symop - * @return Coordinate pointer, or NULL if symmetry operation was invalid. + * @return Coordinate pointer, or nullptr if symmetry operation was invalid. */ float const* CoordSet::coordPtrSym( int idx, pymol::SymOp const& symop, float* v_out, bool inv) const @@ -208,25 +208,25 @@ int BondInOrder(BondType const* a, int b1, int b2) int CoordSetFromPyList(PyMOLGlobals * G, PyObject * list, CoordSet ** cs) { - CoordSet *I = NULL; + CoordSet *I = nullptr; int ok = true; int ll = 0; if(*cs) { delete *cs; - *cs = NULL; + *cs = nullptr; } if(list == Py_None) { /* allow None for CSet */ - *cs = NULL; + *cs = nullptr; } else { if(ok) I = CoordSetNew(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -261,7 +261,7 @@ int CoordSetFromPyList(PyMOLGlobals * G, PyObject * list, CoordSet ** cs) if (!CPythonVal_IsNone(val)) I->SculptCGO = CGONewFromPyList(G, val, 0, 1); else { - I->SculptShaderCGO = I->SculptCGO = NULL; + I->SculptShaderCGO = I->SculptCGO = nullptr; } CPythonVal_Free(val); } @@ -283,7 +283,7 @@ int CoordSetFromPyList(PyMOLGlobals * G, PyObject * list, CoordSet ** cs) CPythonVal_Free(val2); } } else { - I->atom_state_setting_id = NULL; + I->atom_state_setting_id = nullptr; } CPythonVal_Free(val); } else { @@ -311,7 +311,7 @@ int CoordSetFromPyList(PyMOLGlobals * G, PyObject * list, CoordSet ** cs) if(!ok) { delete I; - *cs = NULL; + *cs = nullptr; } else { *cs = I; } @@ -327,10 +327,10 @@ PyObject *CoordSetAsNumPyArray(CoordSet * cs, short copy) #ifndef _PYMOL_NUMPY PRINTFB(cs->G, FB_CoordSet, FB_Errors) "No numpy support\n" ENDFB(cs->G); - return NULL; + return nullptr; #else - PyObject *result = NULL; + PyObject *result = nullptr; const int base_size = sizeof(float); int typenum = -1; npy_intp dims[2] = {0, 3}; @@ -344,7 +344,7 @@ PyObject *CoordSetAsNumPyArray(CoordSet * cs, short copy) if(typenum == -1) { printf("error: no typenum for float size %d\n", base_size); - return NULL; + return nullptr; } dims[0] = cs->NIndex; @@ -362,7 +362,7 @@ PyObject *CoordSetAsNumPyArray(CoordSet * cs, short copy) PyObject *CoordSetAsPyList(CoordSet * I) { - PyObject *result = NULL; + PyObject *result = nullptr; if(I) { auto G = I->G; @@ -396,7 +396,7 @@ PyObject *CoordSetAsPyList(CoordSet * I) } if (I->has_any_atom_state_settings()) { int a; - PyObject *settings_list = NULL; + PyObject *settings_list = nullptr; settings_list = PyList_New(I->NIndex); for (a=0; aNIndex; a++){ if (I->has_atom_state_settings(a)) { @@ -645,7 +645,7 @@ void CoordSet::setTitle(pymol::zstring_view title) /** * Get the transformation matrix which is pre-multiplied to the coordiantes, or - * NULL if there is either no matrix set, or it's not pre-multiplied + * nullptr if there is either no matrix set, or it's not pre-multiplied * (matrix_mode=1). */ double const* CoordSet::getPremultipliedMatrix() const { @@ -1058,7 +1058,7 @@ PyObject *CoordSetAtomToChemPyAtom(PyMOLGlobals * G, AtomInfoType * ai, const fl const float *ref, int index, const double *matrix) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else PyObject *atom = PYOBJECT_CALLMETHOD(P_chempy, "Atom", ""); if(!atom) @@ -1318,13 +1318,13 @@ void CoordSetUpdateCoord2IdxMap(CoordSet * I, float cutoff) if((I->Coord2IdxDiv < cutoff) || (((cutoff - I->Coord2IdxReq) / I->Coord2IdxReq) < -0.5F)) { MapFree(I->Coord2Idx); - I->Coord2Idx = NULL; + I->Coord2Idx = nullptr; } } if(I->NIndex && (!I->Coord2Idx)) { /* NOTE: map based on stored coords */ I->Coord2IdxReq = cutoff; I->Coord2IdxDiv = cutoff * 1.25F; - I->Coord2Idx = MapNew(I->G, I->Coord2IdxDiv, I->Coord, I->NIndex, NULL); + I->Coord2Idx = MapNew(I->G, I->Coord2IdxDiv, I->Coord, I->NIndex, nullptr); if(I->Coord2IdxDiv < I->Coord2Idx->Div) I->Coord2IdxDiv = I->Coord2Idx->Div; } @@ -1658,7 +1658,7 @@ void RefPosTypeCopy(const RefPosType * src, RefPosType * dst){ #ifndef _PYMOL_NOPY int CoordSetSetSettingFromPyObject(PyMOLGlobals * G, CoordSet *cs, int at, int setting_id, PyObject *val){ if (val == Py_None) - val = NULL; + val = nullptr; if (!val && !cs->has_atom_state_settings(at)) { return true; @@ -1682,7 +1682,7 @@ PyObject *SettingGetIfDefinedPyObject(PyMOLGlobals * G, CoordSet *cs, int at, in if (cs->has_atom_state_settings(at)) { return SettingUniqueGetPyObject(G, cs->atom_state_setting_id[at], setting_id); } - return NULL; + return nullptr; } int CoordSetCheckUniqueID(PyMOLGlobals * G, CoordSet *I, int at){ diff --git a/layer2/DistSet.cpp b/layer2/DistSet.cpp index 5f6f726f8..2cf5cc2e2 100644 --- a/layer2/DistSet.cpp +++ b/layer2/DistSet.cpp @@ -102,7 +102,7 @@ int DistSetMoveLabel(DistSet * I, int a1, float *v, int mode) auto& lp = I->LabPos[a1]; if(!lp.mode) { auto obj = I->Obj; - const float *lab_pos = SettingGet_3fv(obj->G, NULL, obj->Setting.get(), + const float *lab_pos = SettingGet_3fv(obj->G, nullptr, obj->Setting.get(), cSetting_label_position); copy3f(lab_pos, lp.pos); } @@ -118,8 +118,8 @@ int DistSetMoveLabel(DistSet * I, int a1, float *v, int mode) /** - * @param I measurement set, must not be NULL - * @param obj object molecule, can be NULL so then all items in I will be updated + * @param I measurement set, must not be nullptr + * @param obj object molecule, can be nullptr so then all items in I will be updated * @return number of updated coordinates */ int DistSetMoveWithObject(DistSet * I, struct ObjectMolecule *obj) @@ -134,7 +134,7 @@ int DistSetMoveWithObject(DistSet * I, struct ObjectMolecule *obj) for (auto& listitem : I->MeasureInfo) { auto* memb = &listitem; - varDst = NULL; + varDst = nullptr; switch(memb->measureType) { case cRepDash: @@ -253,7 +253,7 @@ static PyObject* MeasureInfoListAsPyList( DistSet* DistSetFromPyList(PyMOLGlobals * G, PyObject * list) { - DistSet *I = NULL; + DistSet *I = nullptr; int ll = 0; CPythonVal *val; @@ -311,7 +311,7 @@ DistSet* DistSetFromPyList(PyMOLGlobals * G, PyObject * list) PyObject *DistSetAsPyList(DistSet * I) { - PyObject *result = NULL; + PyObject *result = nullptr; if(I) { result = PyList_New(10); diff --git a/layer2/GadgetSet.cpp b/layer2/GadgetSet.cpp index e12967f21..1517f895d 100644 --- a/layer2/GadgetSet.cpp +++ b/layer2/GadgetSet.cpp @@ -88,24 +88,24 @@ int GadgetSetSetVertex(GadgetSet * I, int index, int base, const float *v) int GadgetSetFromPyList(PyMOLGlobals * G, PyObject * list, GadgetSet ** gs, int version) { int ok = true; - GadgetSet *I = NULL; - PyObject *tmp = NULL; + GadgetSet *I = nullptr; + PyObject *tmp = nullptr; if(*gs) { delete *gs; - *gs = NULL; + *gs = nullptr; } if(list == Py_None) { /* allow None for GSet */ - *gs = NULL; + *gs = nullptr; } else { if(ok) I = GadgetSetNew(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... @@ -127,14 +127,14 @@ int GadgetSetFromPyList(PyMOLGlobals * G, PyObject * list, GadgetSet ** gs, int ok = PConvPyListToFloatVLA(PyList_GetItem(list, 5), &I->Color); if(ok) - ok = ((tmp = PyList_GetItem(list, 6)) != NULL); + ok = ((tmp = PyList_GetItem(list, 6)) != nullptr); if(ok && (tmp != Py_None)) - ok = ((I->ShapeCGO = CGONewFromPyList(I->G, tmp, version)) != NULL); + ok = ((I->ShapeCGO = CGONewFromPyList(I->G, tmp, version)) != nullptr); if(ok) - ok = ((tmp = PyList_GetItem(list, 7)) != NULL); + ok = ((tmp = PyList_GetItem(list, 7)) != nullptr); if(ok && (tmp != Py_None)) - ok = ((I->PickShapeCGO = CGONewFromPyList(I->G, tmp, version)) != NULL); + ok = ((I->PickShapeCGO = CGONewFromPyList(I->G, tmp, version)) != nullptr); if(ok && I->ShapeCGO) if(CGOCheckForText(I->ShapeCGO)) { @@ -154,7 +154,7 @@ int GadgetSetFromPyList(PyMOLGlobals * G, PyObject * list, GadgetSet ** gs, int PyObject *GadgetSetAsPyList(GadgetSet * I, bool incl_cgos) { - PyObject *result = NULL; + PyObject *result = nullptr; if(I) { result = PyList_New(8); @@ -228,12 +228,12 @@ void GadgetSet::update() if(I->StdCGO) { CGOFree(I->StdCGO); I->offsetPtOP = 0; - I->StdCGO = NULL; + I->StdCGO = nullptr; } if(I->PickCGO) { CGOFree(I->PickCGO); I->offsetPtOPick = 0; - I->PickCGO = NULL; + I->PickCGO = nullptr; } } @@ -265,7 +265,7 @@ void GadgetSet::render(RenderInfo * info) RayPushTTT(ray); RaySetTTT(ray, true, mat); /* Used to set the ray-tracing matrix, this works, but is there another way to do this? */ - CGORenderRay(I->ShapeCGO, ray, info, color, NULL, I->Obj->Setting.get(), NULL); + CGORenderRay(I->ShapeCGO, ray, info, color, nullptr, I->Obj->Setting.get(), nullptr); RayPopTTT(ray); } } else if(G->HaveGUI && G->ValidContext) { @@ -300,12 +300,12 @@ void GadgetSet::render(RenderInfo * info) } if(I->PickCGO) { if (use_shader){ - CGORenderPicking(I->PickCGO, info, &context, I->Obj->Setting.get(), NULL); + CGORenderPicking(I->PickCGO, info, &context, I->Obj->Setting.get(), nullptr); #ifndef PURE_OPENGL_ES_2 } else { glDisable(GL_DEPTH_TEST); glTranslatef(I->Coord[0],I->Coord[1],I->Coord[2]); - CGORenderPicking(I->PickShapeCGO, info, &context, I->Obj->Setting.get(), NULL); + CGORenderPicking(I->PickShapeCGO, info, &context, I->Obj->Setting.get(), nullptr); glTranslatef(-I->Coord[0],-I->Coord[1],-I->Coord[2]); glEnable(GL_DEPTH_TEST); #endif @@ -333,12 +333,12 @@ void GadgetSet::render(RenderInfo * info) if(I->StdCGO) { if (use_shader){ if (color) - CGORender(I->StdCGO, NULL, I->Obj->Setting.get(), NULL, info, NULL); + CGORender(I->StdCGO, nullptr, I->Obj->Setting.get(), nullptr, info, nullptr); #ifndef PURE_OPENGL_ES_2 } else { glDisable(GL_DEPTH_TEST); glTranslatef(I->Coord[0],I->Coord[1],I->Coord[2]); - CGORender(I->ShapeCGO, NULL, I->Obj->Setting.get(), NULL, info, NULL); + CGORender(I->ShapeCGO, nullptr, I->Obj->Setting.get(), nullptr, info, nullptr); glTranslatef(-I->Coord[0],-I->Coord[1],-I->Coord[2]); glEnable(GL_DEPTH_TEST); #endif diff --git a/layer2/MmtfMoleculeReader.cpp b/layer2/MmtfMoleculeReader.cpp index c8357eb5e..4e7e11f5e 100644 --- a/layer2/MmtfMoleculeReader.cpp +++ b/layer2/MmtfMoleculeReader.cpp @@ -108,7 +108,7 @@ ObjectMolecule * ObjectMoleculeReadMmtfStr(PyMOLGlobals * G, ObjectMolecule * I, #ifdef _PYMOL_NO_MSGPACKC PRINTFB(G, FB_ObjectMolecule, FB_Errors) " Error: This build has no fast MMTF support.\n" ENDFB(G); - return NULL; + return nullptr; #else if (I) { diff --git a/layer2/MolV3000.cpp b/layer2/MolV3000.cpp index 970dbfe18..09bef21ef 100644 --- a/layer2/MolV3000.cpp +++ b/layer2/MolV3000.cpp @@ -103,7 +103,7 @@ bool MOLV3000ReadKeyValue(const char *& p, /** * Parse the "Extended Connection Table" (V3000) from a MOL/SDF file. * - * Returns a pointer to the end of the parsed content on success, or NULL on + * Returns a pointer to the end of the parsed content on success, or nullptr on * failure. * * buffer: input buffer, should begin with "M V30 " diff --git a/layer2/ObjectAlignment.cpp b/layer2/ObjectAlignment.cpp index 71d75dc0b..783d893d8 100644 --- a/layer2/ObjectAlignment.cpp +++ b/layer2/ObjectAlignment.cpp @@ -180,9 +180,9 @@ int ObjectAlignmentAsStrVLA(PyMOLGlobals * G, ObjectAlignment * I, int state, in if(align_sele >= 0) { int nRow = 0; ov_size nCol = 0; - CSeqRow *row_vla = NULL, *row; - char *cons_str = NULL; - void *hidden = NULL; + CSeqRow *row_vla = nullptr, *row; + char *cons_str = nullptr; + void *hidden = nullptr; ObjectMolecule *obj; @@ -292,7 +292,7 @@ int ObjectAlignmentAsStrVLA(PyMOLGlobals * G, ObjectAlignment * I, int state, in row = row_vla + a; row->txt = pymol::vla(nCol + 1); row->len = 0; - row->last_ai = NULL; + row->last_ai = nullptr; row->cCol = 0; } } @@ -471,7 +471,7 @@ static int *AlignmentMerge(PyMOLGlobals * G, int *curVLA, const int *newVLA, ObjectMolecule * guide, ObjectMolecule * flush) { /* curVLA and newVLA must be properly sized and zero terminated... */ - int *result = NULL; + int *result = nullptr; int n_result = 0; { @@ -618,7 +618,7 @@ static int *AlignmentMerge(PyMOLGlobals * G, int *curVLA, const int *newVLA, if(!GroupOrderKnown(G, curVLA, newVLA, cur_start, new_start, guide, &action)) { int c, id; - ObjectMolecule *obj, *last_obj = NULL; + ObjectMolecule *obj, *last_obj = nullptr; c = cur_start; while((id = curVLA[c++])) { auto eoo = ExecutiveUniqueIDAtomDictGet(G, id); @@ -737,7 +737,7 @@ static int *AlignmentMerge(PyMOLGlobals * G, int *curVLA, const int *newVLA, static PyObject *ObjectAlignmentStateAsPyList(ObjectAlignmentState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(2); if(I->alignVLA) { @@ -752,7 +752,7 @@ static PyObject *ObjectAlignmentStateAsPyList(ObjectAlignmentState * I) static PyObject *ObjectAlignmentAllStatesAsPyList(ObjectAlignment * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->getNFrame()); for(a = 0; a < I->getNFrame(); a++) { @@ -768,7 +768,7 @@ static int ObjectAlignmentStateFromPyList(PyMOLGlobals * G, ObjectAlignmentState int ok = true; int ll = 0; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -814,16 +814,16 @@ int ObjectAlignmentNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectAlignment ** result, int version) { int ok = true; - ObjectAlignment *I = NULL; - (*result) = NULL; + ObjectAlignment *I = nullptr; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); I = new ObjectAlignment(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ auto *val = PyList_GetItem(list, 0); @@ -842,7 +842,7 @@ int ObjectAlignmentNewFromPyList(PyMOLGlobals * G, PyObject * list, PyObject *ObjectAlignmentAsPyList(ObjectAlignment * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(3); PyList_SetItem(result, 0, ObjectAsPyList(I)); @@ -897,7 +897,7 @@ void ObjectAlignment::update() for(a = 0; a < getNFrame(); a++) { ObjectAlignmentState *oas = I->State.data() + a; if(!oas->valid){ - ObjectMolecule *guide_obj = NULL; + ObjectMolecule *guide_obj = nullptr; if(oas->guide[0]) { guide_obj = ExecutiveFindObjectMoleculeByName(G, oas->guide); } @@ -1058,7 +1058,7 @@ void ObjectAlignment::render(RenderInfo * info) CRay *ray = info->ray; auto pick = info->pick; const RenderPass pass = info->pass; - ObjectAlignmentState *sobj = NULL; + ObjectAlignmentState *sobj = nullptr; const float *color; ObjectPrepareContext(I, info); @@ -1078,7 +1078,7 @@ void ObjectAlignment::render(RenderInfo * info) continue; if(ray) { - CGORenderRay(sobj->primitiveCGO.get(), ray, info, color, NULL, I->Setting.get(), NULL); + CGORenderRay(sobj->primitiveCGO.get(), ray, info, color, nullptr, I->Setting.get(), nullptr); } else if(G->HaveGUI && G->ValidContext) { #ifndef PURE_OPENGL_ES_2 if(!info->line_lighting) @@ -1087,7 +1087,7 @@ void ObjectAlignment::render(RenderInfo * info) SceneResetNormal(G, true); bool use_shader = SettingGetGlobal_b(G, cSetting_use_shaders); - CGO * cgo = NULL; + CGO * cgo = nullptr; if (use_shader) { bool as_cylinders = @@ -1107,7 +1107,7 @@ void ObjectAlignment::render(RenderInfo * info) as_cylinders ? GL_CYLINDER_SHADER : trilines ? GL_TRILINES_SHADER : GL_LINE_SHADER; - CGO *tmpCGO = CGONew(G), *tmp2CGO = NULL; + CGO *tmpCGO = CGONew(G), *tmp2CGO = nullptr; CGOEnable(tmpCGO, shader); CGOSpecial(tmpCGO, SET_ALIGNMENT_UNIFORMS_ATTRIBS); @@ -1134,7 +1134,7 @@ void ObjectAlignment::render(RenderInfo * info) } if (cgo) { - CGORender(cgo, color, I->Setting.get(), NULL, info, NULL); + CGORender(cgo, color, I->Setting.get(), nullptr, info, nullptr); } #ifndef PURE_OPENGL_ES_2 @@ -1173,11 +1173,11 @@ ObjectAlignment *ObjectAlignmentDefine(PyMOLGlobals * G, int merge, ObjectMolecule * guide, ObjectMolecule * flush) { - ObjectAlignment *I = NULL; + ObjectAlignment *I = nullptr; if(obj) { if(obj->type != cObjectAlignment) /* TODO: handle this */ - obj = NULL; + obj = nullptr; } if(!obj) { I = new ObjectAlignment(G); diff --git a/layer2/ObjectCGO.cpp b/layer2/ObjectCGO.cpp index 070e1941d..7585482ef 100644 --- a/layer2/ObjectCGO.cpp +++ b/layer2/ObjectCGO.cpp @@ -36,7 +36,7 @@ Z* ------------------------------------------------------------------- static PyObject *ObjectCGOStateAsPyList(ObjectCGOState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(1); if(I->origCGO) @@ -48,7 +48,7 @@ static PyObject *ObjectCGOStateAsPyList(ObjectCGOState * I) static PyObject *ObjectCGOAllStatesAsPyList(ObjectCGO * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->State.size()); for(a = 0; a < I->State.size(); a++) { @@ -64,7 +64,7 @@ static int ObjectCGOStateFromPyList(PyMOLGlobals * G, ObjectCGOState * I, PyObje int ll, pl = 0; PyObject *tmp; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -118,16 +118,16 @@ int ObjectCGONewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectCGO ** resul int version) { int ok = true; - ObjectCGO *I = NULL; - (*result) = NULL; + ObjectCGO *I = nullptr; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); I = new ObjectCGO(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ auto *val = PyList_GetItem(list, 0); @@ -149,7 +149,7 @@ int ObjectCGONewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectCGO ** resul PyObject *ObjectCGOAsPyList(ObjectCGO * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(3); PyList_SetItem(result, 0, ObjectAsPyList(I)); @@ -235,11 +235,11 @@ static void ObjectCGORenderState(PyMOLGlobals* G, RenderPass pass, CRay* ray, if(ray) { if(sobj) { if(sobj->origCGO){ - CGO *cgo = sobj->origCGO.get(), *cgo_copy = NULL; + CGO *cgo = sobj->origCGO.get(), *cgo_copy = nullptr; if (cgo_lighting && CGOHasAnyTriangleVerticesWithoutNormals(cgo)) { cgo = cgo_copy = CGOGenerateNormalsForTriangles(cgo); } - CGORenderRay(cgo, ray, info, color, ramp, I->Setting.get(), NULL); + CGORenderRay(cgo, ray, info, color, ramp, I->Setting.get(), nullptr); CGOFree(cgo_copy); } } @@ -254,8 +254,8 @@ static void ObjectCGORenderState(PyMOLGlobals* G, RenderPass pass, CRay* ray, if(sobj && ((sobj->hasTransparency ^ pass_is_opaque) || (sobj->hasOpaque == pass_is_opaque))){ { CShaderPrg *shaderPrg; - int two_sided_lighting = SettingGet_i(G, I->Setting.get(), NULL, cSetting_two_sided_lighting); - bool backface_cull = SettingGet_i(G, I->Setting.get(), NULL, cSetting_backface_cull); + int two_sided_lighting = SettingGet_i(G, I->Setting.get(), nullptr, cSetting_two_sided_lighting); + bool backface_cull = SettingGet_i(G, I->Setting.get(), nullptr, cSetting_backface_cull); if (two_sided_lighting<0){ two_sided_lighting = !cgo_lighting; } @@ -288,12 +288,12 @@ static void ObjectCGORenderState(PyMOLGlobals* G, RenderPass pass, CRay* ray, shaderPrg->Set1i("two_sided_lighting_enabled", two_sided_lighting); sobj->renderCGO->use_shader = use_shader; sobj->renderCGO->debug = SettingGetGlobal_i(G, cSetting_cgo_debug); - CGORender(sobj->renderCGO.get(), color, I->Setting.get(), NULL, info, NULL); + CGORender(sobj->renderCGO.get(), color, I->Setting.get(), nullptr, info, nullptr); shaderPrg->Disable(); } else { sobj->renderCGO->use_shader = use_shader; sobj->renderCGO->debug = SettingGetGlobal_i(G, cSetting_cgo_debug); - CGORender(sobj->renderCGO.get(), color, I->Setting.get(), NULL, info, NULL); + CGORender(sobj->renderCGO.get(), color, I->Setting.get(), nullptr, info, nullptr); } if (backface_cull){ glDisable(GL_CULL_FACE); @@ -330,13 +330,13 @@ static void ObjectCGOGenerateCGO(PyMOLGlobals * G, ObjectCGO * I, ObjectCGOState } else { colorWithA[0] = 1.f; colorWithA[1] = 1.f; colorWithA[2] = 1.f; } - colorWithA[3] = 1.f - SettingGet_f(G, I->Setting.get(), NULL, cSetting_cgo_transparency); + colorWithA[3] = 1.f - SettingGet_f(G, I->Setting.get(), nullptr, cSetting_cgo_transparency); bool hasTransparency = (colorWithA[3] < 1.f || CGOHasTransparency(sobj->origCGO.get())); bool hasOpaque = (colorWithA[3] == 1.f || CGOHasOpaque(sobj->origCGO.get())); - CGO *allCylinders = NULL; - CGO *allSpheres = NULL; + CGO *allCylinders = nullptr; + CGO *allSpheres = nullptr; CGO* allBeziers = nullptr; pymol::cache_ptr preOpt; @@ -478,14 +478,14 @@ void ObjectCGO::render(RenderInfo * info) int state = info->state; CRay *ray = info->ray; const RenderPass pass = info->pass; - ObjectCGOState *sobj = NULL; - const float *color = NULL; + ObjectCGOState *sobj = nullptr; + const float *color = nullptr; bool use_shader = false, cgo_lighting = false; - ObjectGadgetRamp *ramp = NULL; + ObjectGadgetRamp *ramp = nullptr; use_shader = SettingGetGlobal_b(G, cSetting_cgo_use_shader) & SettingGetGlobal_b(G, cSetting_use_shaders); - cgo_lighting = SettingGet_i(G, I->Setting.get(), NULL, cSetting_cgo_lighting); + cgo_lighting = SettingGet_i(G, I->Setting.get(), nullptr, cSetting_cgo_lighting); ObjectPrepareContext(I, info); ramp = ColorGetRamp(G, I->Color); @@ -547,11 +547,11 @@ ObjectCGOState::ObjectCGOState(const ObjectCGOState& other) static CGO *ObjectCGOPyListFloatToCGO(PyMOLGlobals * G, PyObject * list) { - CGO *cgo = NULL; + CGO *cgo = nullptr; int len; int ok = true; int result; - float *raw = NULL; + float *raw = nullptr; if(PyList_Check(list)) { len = PConvPyListToFloatArray(list, &raw); @@ -578,7 +578,7 @@ static CGO *ObjectCGOPyListFloatToCGO(PyMOLGlobals * G, PyObject * list) static CGO *ObjectCGOFloatArrayToCGO(PyMOLGlobals * G, float *raw, int len, int quiet) { - CGO *cgo = NULL; + CGO *cgo = nullptr; int ok = true; int result; @@ -601,7 +601,7 @@ static CGO *ObjectCGOFloatArrayToCGO(PyMOLGlobals * G, float *raw, int len, int ObjectCGO *ObjectCGOFromCGO(PyMOLGlobals * G, ObjectCGO * obj, CGO * cgo, int state) { - ObjectCGO *I = NULL; + ObjectCGO *I = nullptr; int size_n; @@ -635,15 +635,15 @@ ObjectCGO *ObjectCGOFromCGO(PyMOLGlobals * G, ObjectCGO * obj, CGO * cgo, int st ObjectCGO *ObjectCGONewVFontTest(PyMOLGlobals * G, const char *text, float *pos) { - ObjectCGO *I = NULL; + ObjectCGO *I = nullptr; int font_id; - CGO *cgo = NULL; + CGO *cgo = nullptr; float scale[2] = { 1.0, 1.0 }; font_id = VFontLoad(G, 1, 1, 1, true); cgo = CGONew(G); - VFontWriteToCGO(G, font_id, cgo, text, pos, scale, NULL, NULL); - I = ObjectCGOFromCGO(G, NULL, cgo, 0); + VFontWriteToCGO(G, font_id, cgo, text, pos, scale, nullptr, nullptr); + I = ObjectCGOFromCGO(G, nullptr, cgo, 0); return (I); } @@ -657,7 +657,7 @@ ObjectCGO *ObjectCGODefine(PyMOLGlobals * G, ObjectCGO * obj, PyObject * pycgo, { assert(PyGILState_Check()); - ObjectCGO *I = NULL; + ObjectCGO *I = nullptr; CGO *cgo, *font_cgo; int est; @@ -666,7 +666,7 @@ ObjectCGO *ObjectCGODefine(PyMOLGlobals * G, ObjectCGO * obj, PyObject * pycgo, if(obj) { if(obj->type != cObjectCGO){ /* TODO: handle this */ - obj = NULL; + obj = nullptr; } size_n = obj->State.size(); } @@ -693,7 +693,7 @@ ObjectCGO *ObjectCGODefine(PyMOLGlobals * G, ObjectCGO * obj, PyObject * pycgo, est = CGOCheckForText(cgo); if(est) { CGOPreloadFonts(cgo); - font_cgo = CGODrawText(cgo, est, NULL); + font_cgo = CGODrawText(cgo, est, nullptr); CGOFree(cgo); cgo = font_cgo; } @@ -716,7 +716,7 @@ ObjectCGO *ObjectCGODefine(PyMOLGlobals * G, ObjectCGO * obj, PyObject * pycgo, ObjectCGO *ObjectCGOFromFloatArray(PyMOLGlobals * G, ObjectCGO * obj, float *array, int size, int state, int quiet) { - ObjectCGO *I = NULL; + ObjectCGO *I = nullptr; CGO *cgo, *font_cgo; int est; @@ -725,7 +725,7 @@ ObjectCGO *ObjectCGOFromFloatArray(PyMOLGlobals * G, ObjectCGO * obj, if(obj) { if(obj->type != cObjectCGO){ /* TODO: handle this */ - obj = NULL; + obj = nullptr; } size_n = obj->State.size(); } @@ -749,7 +749,7 @@ ObjectCGO *ObjectCGOFromFloatArray(PyMOLGlobals * G, ObjectCGO * obj, est = CGOCheckForText(cgo); if(est) { CGOPreloadFonts(cgo); - font_cgo = CGODrawText(cgo, est, NULL); + font_cgo = CGODrawText(cgo, est, nullptr); CGOFree(cgo); cgo = font_cgo; } diff --git a/layer2/ObjectCallback.cpp b/layer2/ObjectCallback.cpp index 929d667ae..51ac10838 100644 --- a/layer2/ObjectCallback.cpp +++ b/layer2/ObjectCallback.cpp @@ -42,7 +42,7 @@ ObjectCallback::~ObjectCallback() for(int a = 0; a < I->NState; a++) { if(I->State[a].PObj) { Py_DECREF(I->State[a].PObj); - I->State[a].PObj = NULL; + I->State[a].PObj = nullptr; } } PAutoUnblock(G, blocked); @@ -70,7 +70,7 @@ void ObjectCallback::render(RenderInfo * info) auto pick = info->pick; const RenderPass pass = info->pass; PyMOLGlobals *G = I->G; - ObjectCallbackState *sobj = NULL; + ObjectCallbackState *sobj = nullptr; if(pass != RenderPass::Opaque) /* for now, the callback should be called during the first pass (opaque), so that it is possible to set positions for any object that is rendered in the @@ -102,7 +102,7 @@ void ObjectCallback::render(RenderInfo * info) if(!sobj->is_callable) continue; - Py_DecRef(PyObject_CallObject(sobj->PObj, NULL)); + Py_DecRef(PyObject_CallObject(sobj->PObj, nullptr)); if(PyErr_Occurred()) PyErr_Print(); } @@ -132,9 +132,9 @@ ObjectCallback *ObjectCallbackDefine(PyMOLGlobals * G, ObjectCallback * obj, PyObject * pobj, int state) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else - ObjectCallback *I = NULL; + ObjectCallback *I = nullptr; if(!obj) { I = new ObjectCallback(G); @@ -222,7 +222,7 @@ static int ObjectCallbackStateFromPyObject(PyMOLGlobals * G, ObjectCallbackState static int ObjectCallbackAllStatesFromPyObject(ObjectCallback * I, PyObject * obj) { int result = false; - PyObject *list = NULL; + PyObject *list = nullptr; if(PyList_Check(obj)) { list = obj; @@ -260,7 +260,7 @@ int ObjectCallbackNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectCallbac ObjectCallback *I; PyObject *val; - ok_assert(1, list != NULL); + ok_assert(1, list != nullptr); ok_assert(1, PyList_Check(list)); ok_assert(1, I = new ObjectCallback(G)); @@ -278,7 +278,7 @@ int ObjectCallbackNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectCallbac ok_except2: DeleteP(I); ok_except1: - *result = NULL; + *result = nullptr; return false; } @@ -293,7 +293,7 @@ static PyObject *ObjectCallbackStateAsPyObject(ObjectCallbackState * I) static PyObject *ObjectCallbackAllStatesAsPyObject(ObjectCallback * I) { int a; - PyObject *result = NULL; + PyObject *result = nullptr; PyObject *list = PyList_New(I->NState); for(a = 0; a < I->NState; a++) { @@ -318,7 +318,7 @@ static PyObject *ObjectCallbackAllStatesAsPyObject(ObjectCallback * I) PyObject *ObjectCallbackAsPyList(ObjectCallback * I) { - PyObject *result = NULL, *states; + PyObject *result = nullptr, *states; ok_assert(1, states = ObjectCallbackAllStatesAsPyObject(I)); diff --git a/layer2/ObjectDist.cpp b/layer2/ObjectDist.cpp index b7a7c7d1b..741d03dd8 100644 --- a/layer2/ObjectDist.cpp +++ b/layer2/ObjectDist.cpp @@ -44,7 +44,7 @@ int ObjectDistGetLabelTxfVertex(ObjectDist * I, int state, int index, float *v) int result = 0; if(!I->DSet.empty()) { if(state < 0) - state = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_state) - 1; + state = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_state) - 1; if(state < 0) state = SceneGetState(I->G); if(I->DSet.size() == 1) @@ -52,7 +52,7 @@ int ObjectDistGetLabelTxfVertex(ObjectDist * I, int state, int index, float *v) state = state % I->DSet.size(); { DistSet *ds = I->DSet[state].get(); - if((!ds) && (SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_all_states))) { + if((!ds) && (SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_all_states))) { state = 0; ds = I->DSet[state].get(); } @@ -74,7 +74,7 @@ int ObjectDistMoveLabel(ObjectDist * I, int state, int index, float *v, int mode state = 0; state = state % I->DSet.size(); if((!I->DSet[state]) - && (SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_all_states))) + && (SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_all_states))) state = 0; /* find the corresponding distance set, for this state */ auto ds = I->DSet[state].get(); @@ -178,7 +178,7 @@ static int ObjectDistDSetFromPyList(ObjectDist * I, PyObject * list) /*========================================================================*/ PyObject *ObjectDistAsPyList(ObjectDist * I) { - PyObject *result = NULL; + PyObject *result = nullptr; /* first, dump the atoms */ @@ -195,15 +195,15 @@ PyObject *ObjectDistAsPyList(ObjectDist * I) int ObjectDistNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectDist ** result) { int ok = true; - ObjectDist *I = NULL; - (*result) = NULL; + ObjectDist *I = nullptr; + (*result) = nullptr; if(ok) ok = PyList_Check(list); I = new ObjectDist(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ auto *val = PyList_GetItem(list, 0); diff --git a/layer2/ObjectGadget.cpp b/layer2/ObjectGadget.cpp index ff3825ad6..ed2f90757 100644 --- a/layer2/ObjectGadget.cpp +++ b/layer2/ObjectGadget.cpp @@ -67,9 +67,9 @@ int ObjectGadgetSetVertex(ObjectGadget * I, int index, int base, const float *v) /* in current state */ ObjectGadget *ObjectGadgetTest(PyMOLGlobals * G) { - ObjectGadget *I = NULL; - GadgetSet *gs = NULL; - CGO *cgo = NULL; + ObjectGadget *I = nullptr; + GadgetSet *gs = nullptr; + CGO *cgo = nullptr; int a; float coord[] = { @@ -255,7 +255,7 @@ void ObjectGadgetUpdateExtents(ObjectGadget * I) static PyObject *ObjectGadgetGSetAsPyList(ObjectGadget * I, bool incl_cgos) { - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->NGSet); for(a = 0; a < I->NGSet; a++) { @@ -297,7 +297,7 @@ int ObjectGadgetInitFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGadget * { int ok = true; if(ok) - ok = (I != NULL) && (list != NULL); + ok = (I != nullptr) && (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... @@ -328,13 +328,13 @@ int ObjectGadgetNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGadget ** int version) { int ok = true; - ObjectGadget *I = NULL; + ObjectGadget *I = nullptr; int gadget_type = -1; PyObject *plain; - (*result) = NULL; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); @@ -342,7 +342,7 @@ int ObjectGadgetNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGadget ** we've got to maintain backward compat...ugh */ if(ok) - ok = ((plain = PyList_GetItem(list, 0)) != NULL); + ok = ((plain = PyList_GetItem(list, 0)) != nullptr); if(ok) ok = PyList_Check(plain); if(ok) @@ -355,7 +355,7 @@ int ObjectGadgetNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGadget ** case cGadgetPlain: I = new ObjectGadget(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) ok = ObjectGadgetInitFromPyList(G, list, I, version); if(ok) @@ -370,7 +370,7 @@ int ObjectGadgetNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGadget ** PyObject *ObjectGadgetPlainAsPyList(ObjectGadget * I, bool incl_cgos) { - PyObject *result = NULL; + PyObject *result = nullptr; /* first, dump the atoms */ @@ -385,7 +385,7 @@ PyObject *ObjectGadgetPlainAsPyList(ObjectGadget * I, bool incl_cgos) PyObject *ObjectGadgetAsPyList(ObjectGadget * I) { - PyObject *result = NULL; + PyObject *result = nullptr; /* first, dump the atoms */ @@ -406,7 +406,7 @@ ObjectGadget::~ObjectGadget() for(int a = 0; a < I->NGSet; a++) if(I->GSet[a]) { delete I->GSet[a]; - I->GSet[a] = NULL; + I->GSet[a] = nullptr; } } diff --git a/layer2/ObjectGadgetRamp.cpp b/layer2/ObjectGadgetRamp.cpp index b24fc87e2..737d4f6f3 100644 --- a/layer2/ObjectGadgetRamp.cpp +++ b/layer2/ObjectGadgetRamp.cpp @@ -347,7 +347,7 @@ int ObjectGadgetRampInterpolate(ObjectGadgetRamp * I, float level, float *color) PyObject *ObjectGadgetRampAsPyList(ObjectGadgetRamp * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(11); @@ -371,7 +371,7 @@ PyObject *ObjectGadgetRampAsPyList(ObjectGadgetRamp * I) // I->Special, removed in PyMOL 1.8 bool any = false; - int* special = NULL; + int* special = nullptr; int pse_export_version = SettingGetGlobal_f(I->G, cSetting_pse_export_version) * 1000; if (I->Color && pse_export_version < 1800) { int n_color = VLAGetSize(I->Color) / 3; @@ -390,16 +390,16 @@ PyObject *ObjectGadgetRampAsPyList(ObjectGadgetRamp * I) int ObjectGadgetRampNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGadgetRamp ** result, int version) { - ObjectGadgetRamp *I = NULL; + ObjectGadgetRamp *I = nullptr; int ok = true; int ll = 0; if(ok) I = new ObjectGadgetRamp(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -436,7 +436,7 @@ int ObjectGadgetRampNewFromPyList(PyMOLGlobals * G, PyObject * list, // ObjectGadgetRamp::Extreme removed in PyMOL 1.8 // Copy extreme colors to the beginning and end of the Color array // and repeat the first and last level value - float *extreme = NULL; + float *extreme = nullptr; PConvPyListToFloatVLA(item, &extreme); if (extreme) { I->NLevel += 2; @@ -486,9 +486,9 @@ int ObjectGadgetRampInterVertex(ObjectGadgetRamp * I, const float *pos, float *c if(src_state < 0) src_state = SceneGetState(I->G); if(ok) - ok = (I->Map != NULL); + ok = (I->Map != nullptr); if(ok) - ok = ObjectMapInterpolate(I->Map, src_state, pos, &level, NULL, 1); + ok = ObjectMapInterpolate(I->Map, src_state, pos, &level, nullptr, 1); if(ok) ok = ObjectGadgetRampInterpolate(I, level, color); } @@ -512,12 +512,12 @@ int ObjectGadgetRampInterVertex(ObjectGadgetRamp * I, const float *pos, float *c } } if(ok) - ok = (I->Mol != NULL); + ok = (I->Mol != nullptr); if(ok) { if (I->Mol->NCSet==1) // if only one state, then set state to 0 state = 0; if(SettingGet_b - (I->G, I->Setting.get(), NULL, + (I->G, I->Setting.get(), nullptr, cSetting_ramp_blend_nearby_colors)) { float atomic[3]; int index = @@ -809,7 +809,7 @@ static void ObjectGadgetRampUpdateCGO(ObjectGadgetRamp * I, GadgetSet * gs) static void ObjectGadgetRampBuild(ObjectGadgetRamp * I) { - GadgetSet *gs = NULL; + GadgetSet *gs = nullptr; ObjectGadget *og; OrthoBusyPrime(I->G); @@ -826,12 +826,12 @@ static void ObjectGadgetRampBuild(ObjectGadgetRamp * I) gs->Coord[2] = .3f; gs->Coord[3] = gs->Coord[4] = gs->Coord[5] = 0.f; gs->NNormal = 0; - gs->Normal = NULL; + gs->Normal = nullptr; // was a memory leak in < 1.8.3.1 for (int i = 0; i < og->NGSet; ++i) { delete og->GSet[i]; - og->GSet[i] = NULL; + og->GSet[i] = nullptr; } og->GSet[0] = gs; diff --git a/layer2/ObjectGroup.cpp b/layer2/ObjectGroup.cpp index ad5032fd3..2e5b593e8 100644 --- a/layer2/ObjectGroup.cpp +++ b/layer2/ObjectGroup.cpp @@ -29,8 +29,8 @@ int ObjectGroupNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGroup ** r int version) { int ok = true, ll = 0; - ObjectGroup *I = NULL; - (*result) = NULL; + ObjectGroup *I = nullptr; + (*result) = nullptr; if(ok) ok = (list != Py_None); if(ok) @@ -39,7 +39,7 @@ int ObjectGroupNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGroup ** r ll = PyList_Size(list); I = new ObjectGroup(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ auto *val = PyList_GetItem(list, 0); ok = ObjectFromPyList(G, val, I); @@ -59,7 +59,7 @@ int ObjectGroupNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectGroup ** r PyObject *ObjectGroupAsPyList(ObjectGroup * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(3); PyList_SetItem(result, 0, ObjectAsPyList(I)); diff --git a/layer2/ObjectMap.cpp b/layer2/ObjectMap.cpp index 8c192e8a1..5dd018ec1 100644 --- a/layer2/ObjectMap.cpp +++ b/layer2/ObjectMap.cpp @@ -158,7 +158,7 @@ int ObjectMapStateGetExcludedStats(PyMOLGlobals * G, ObjectMapState * ms, float int cnt = 0; int list_size; float cutoff = beyond; - MapType *voxelmap = NULL; + MapType *voxelmap = nullptr; /* size of the VLA */ if(vert_vla) { @@ -171,7 +171,7 @@ int ObjectMapStateGetExcludedStats(PyMOLGlobals * G, ObjectMapState * ms, float /* make a new map from the VLA .............. */ if(list_size) - voxelmap = MapNew(G, -cutoff, vert_vla, list_size, NULL); + voxelmap = MapNew(G, -cutoff, vert_vla, list_size, nullptr); if(voxelmap || (!list_size)) { int a, b, c; @@ -1009,7 +1009,7 @@ int ObjectMapStateContainsPoint(ObjectMapState * ms, float *point) * @param[out] result Array of length `n` which will be populated with map * values at coorinate positions (linear interpolated between grid points) * @param[out] flag Array of length `n` which will be populated with booleans - * indicating if points were within map bounds (optional, can be NULL) + * indicating if points were within map bounds (optional, can be nullptr) * @return False if any coordinate was out of bounds */ int ObjectMapStateInterpolate(ObjectMapState * ms, const float *array, float *result, int *flag, @@ -1228,7 +1228,7 @@ void ObjectMapStateRegeneratePoints(ObjectMapState * ms) static PyObject *ObjectMapStateAsPyList(ObjectMapState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(16); PyList_SetItem(result, 0, PyInt_FromLong(I->Active)); @@ -1274,7 +1274,7 @@ static PyObject *ObjectMapStateAsPyList(ObjectMapState * I) static PyObject *ObjectMapAllStatesAsPyList(ObjectMap * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->State.size()); for(a = 0; a < I->State.size(); a++) { @@ -1337,7 +1337,7 @@ static int ObjectMapStateFromPyList(PyMOLGlobals * G, ObjectMapState * I, PyObje int ll = 0; PyObject *tmp; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) { if(!PyList_Check(list)) I->Active = false; @@ -1354,7 +1354,7 @@ static int ObjectMapStateFromPyList(PyMOLGlobals * G, ObjectMapState * I, PyObje if(ok) { tmp = PyList_GetItem(list, 1); if(tmp == Py_None) - I->Symmetry = NULL; + I->Symmetry = nullptr; else { I->Symmetry.reset(SymmetryNewFromPyList(G, tmp)); ok = I->Symmetry != nullptr; @@ -1448,7 +1448,7 @@ static int ObjectMapAllStatesFromPyList(ObjectMap * I, PyObject * list) PyObject *ObjectMapAsPyList(ObjectMap * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(3); PyList_SetItem(result, 0, ObjectAsPyList(I)); @@ -1461,18 +1461,18 @@ PyObject *ObjectMapAsPyList(ObjectMap * I) int ObjectMapNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectMap ** result) { int ok = true; - ObjectMap *I = NULL; - (*result) = NULL; + ObjectMap *I = nullptr; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... Always check ll when adding new PyList_GetItem's */ I = new ObjectMap(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ auto *val = PyList_GetItem(list, 0); @@ -1497,10 +1497,10 @@ int ObjectMapNewCopy(PyMOLGlobals * G, const ObjectMap * src, ObjectMap ** resul int source_state, int target_state) { int ok = true; - ObjectMap *I = NULL; + ObjectMap *I = nullptr; I = new ObjectMap(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok) ok = ObjectCopyHeader(I, src); if(ok) { @@ -1738,7 +1738,7 @@ void ObjectMap::render(RenderInfo * info) CRay *ray = info->ray; auto pick = info->pick; const RenderPass pass = info->pass; - ObjectMapState *ms = NULL; + ObjectMapState *ms = nullptr; if(pass != RenderPass::Antialias) return; @@ -1839,7 +1839,7 @@ void ObjectMap::render(RenderInfo * info) shaderPrg->SetLightingEnabled(0); CGORender(ms->shaderCGO.get(), ColorGet(G, I->Color), - NULL, NULL, info, NULL); + nullptr, nullptr, info, nullptr); shaderPrg->Disable(); } } @@ -1868,7 +1868,7 @@ void ObjectMap::render(RenderInfo * info) ms->have_range = true; } } - if(ms->have_range && SettingGet_b(G, NULL, I->Setting.get(), cSetting_dot_normals)) { + if(ms->have_range && SettingGet_b(G, nullptr, I->Setting.get(), cSetting_dot_normals)) { IsofieldComputeGradients(G, ms->Field.get()); } if(ms->have_range) { @@ -1876,9 +1876,9 @@ void ObjectMap::render(RenderInfo * info) CField *data = ms->Field->data.get(); int cnt = data->dim[0] * data->dim[1] * data->dim[2]; CField *points = ms->Field->points.get(); - CField *gradients = NULL; + CField *gradients = nullptr; - if(SettingGet_b(G, NULL, I->Setting.get(), cSetting_dot_normals)) { + if(SettingGet_b(G, nullptr, I->Setting.get(), cSetting_dot_normals)) { gradients = ms->Field->gradients.get(); } if(data && points) { @@ -1893,10 +1893,10 @@ void ObjectMap::render(RenderInfo * info) ptr += 3; \ } - float *raw_gradient = NULL; + float *raw_gradient = nullptr; float high_cut = ms->high_cutoff, low_cut = ms->low_cutoff; float width = - SettingGet_f(G, NULL, I->Setting.get(), cSetting_dot_width); + SettingGet_f(G, nullptr, I->Setting.get(), cSetting_dot_width); if(ray) { float radius = ray->PixelRadius * width / 1.4142F; @@ -1985,7 +1985,7 @@ ObjectMapState::ObjectMapState(PyMOLGlobals* G) ObjectMapStatePurge(G, I); ObjectStateInit(G, I); I->Symmetry.reset(new CSymmetry(G)); - I->Field = NULL; + I->Field = nullptr; I->Origin.clear(); I->Dim.clear(); I->Range.clear(); @@ -2057,7 +2057,7 @@ ObjectMapState *ObjectMapNewStateFromDesc(PyMOLGlobals * G, ObjectMap * I, float v[3]; int a, b, c, d; float *fp; - ObjectMapState *ms = NULL; + ObjectMapState *ms = nullptr; ObjectMapDesc _md, *md; ms = ObjectMapStatePrime(I, state); @@ -4143,7 +4143,7 @@ static int ObjectMapGRDStrToMap(ObjectMap * I, char *GRDStr, int bytes, int stat char *p; float dens; - float *f = NULL; + float *f = nullptr; int a, b, c, d, e; float v[3], vr[3], maxd, mind; int ok = true; @@ -4665,7 +4665,7 @@ ObjectMap *ObjectMapLoadCCP4(PyMOLGlobals * G, ObjectMap * obj, const char *fnam int is_string, int bytes, int quiet, int format) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; char *buffer; long size; @@ -4814,7 +4814,7 @@ ObjectMap *ObjectMapLoadPHI(PyMOLGlobals * G, ObjectMap * obj, const char *fname int is_string, int bytes, int quiet) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; long size; char *buffer; @@ -5198,7 +5198,7 @@ ObjectMap* ObjectMapReadDXStr(PyMOLGlobals* G, ObjectMap* I, const char* MapStr, ObjectMap *ObjectMapLoadDXFile(PyMOLGlobals * G, ObjectMap * obj, const char *fname, int state, int quiet) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; long size; char *buffer; @@ -5418,7 +5418,7 @@ static ObjectMap *ObjectMapReadACNTStr(PyMOLGlobals * G, ObjectMap * I, ObjectMap *ObjectMapLoadACNTFile(PyMOLGlobals * G, ObjectMap * obj, const char *fname, int state, int quiet) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; long size; char *buffer; @@ -5446,7 +5446,7 @@ ObjectMap *ObjectMapLoadACNTFile(PyMOLGlobals * G, ObjectMap * obj, const char * ObjectMap *ObjectMapLoadFLDFile(PyMOLGlobals * G, ObjectMap * obj, const char *fname, int state, int quiet) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; long size; char *buffer; @@ -5472,7 +5472,7 @@ ObjectMap *ObjectMapLoadFLDFile(PyMOLGlobals * G, ObjectMap * obj, const char *f ObjectMap *ObjectMapLoadBRIXFile(PyMOLGlobals * G, ObjectMap * obj, const char *fname, int state, int quiet) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; long size; char *buffer; @@ -5498,7 +5498,7 @@ ObjectMap *ObjectMapLoadBRIXFile(PyMOLGlobals * G, ObjectMap * obj, const char * ObjectMap *ObjectMapLoadGRDFile(PyMOLGlobals * G, ObjectMap * obj, const char *fname, int state, int quiet) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; long size; char *buffer; @@ -5524,7 +5524,7 @@ ObjectMap *ObjectMapLoadGRDFile(PyMOLGlobals * G, ObjectMap * obj, const char *f ObjectMap *ObjectMapLoadXPLOR(PyMOLGlobals * G, ObjectMap * obj, const char *fname, int state, int is_file, int quiet) { - ObjectMap *I = NULL; + ObjectMap *I = nullptr; long size; char *buffer; @@ -5681,11 +5681,11 @@ ObjectMap *ObjectMapLoadChemPyBrick(PyMOLGlobals * G, ObjectMap * I, PyObject * { #ifndef _PYMOL_NUMPY ErrMessage(G, "ObjectMap", "missing numpy support, required for chempy.brick"); - return NULL; + return nullptr; #endif #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else int ok = true; @@ -5778,7 +5778,7 @@ ObjectMap *ObjectMapLoadChemPyMap(PyMOLGlobals * G, ObjectMap * I, PyObject * Ma int state, int discrete, int quiet) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else int ok = true; int isNew = true; diff --git a/layer2/ObjectMesh.cpp b/layer2/ObjectMesh.cpp index 4f4996073..afc8d5fd4 100644 --- a/layer2/ObjectMesh.cpp +++ b/layer2/ObjectMesh.cpp @@ -44,7 +44,7 @@ static void ObjectMeshRecomputeExtent(ObjectMesh * I); static PyObject *ObjectMeshStateAsPyList(ObjectMeshState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(17); @@ -96,7 +96,7 @@ int ObjectMeshAllMapsInStatesExist(ObjectMesh * I) static PyObject *ObjectMeshAllStatesAsPyList(ObjectMesh * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->NState); for(a = 0; a < I->NState; a++) { @@ -116,14 +116,14 @@ static int ObjectMeshStateFromPyList(PyMOLGlobals * G, ObjectMeshState * I, int ll = 0; PyObject *tmp; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) { if(!PyList_Check(list)) I->Active = false; else { *I = ObjectMeshState(G); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -158,7 +158,7 @@ static int ObjectMeshStateFromPyList(PyMOLGlobals * G, ObjectMeshState * I, if(ok) { tmp = PyList_GetItem(list, 12); if(tmp == Py_None) - I->AtomVertex = NULL; + I->AtomVertex = nullptr; else ok = PConvPyListToFloatVLA(tmp, &I->AtomVertex); } @@ -181,7 +181,7 @@ static int ObjectMeshStateFromPyList(PyMOLGlobals * G, ObjectMeshState * I, if(ok && (ll > 16)) { tmp = PyList_GetItem(list, 16); if(tmp == Py_None) - I->Field = NULL; + I->Field = nullptr; else { I->Field.reset(IsosurfNewFromPyList(G, tmp)); ok = I->Field != nullptr; @@ -215,11 +215,11 @@ static int ObjectMeshAllStatesFromPyList(ObjectMesh * I, PyObject * list) int ObjectMeshNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectMesh ** result) { int ok = true; - ObjectMesh *I = NULL; - (*result) = NULL; + ObjectMesh *I = nullptr; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... @@ -239,7 +239,7 @@ int ObjectMeshNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectMesh ** res ObjectMeshRecomputeExtent(I); } else { DeleteP(I); - (*result) = NULL; + (*result) = nullptr; } return (ok); } @@ -248,7 +248,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG PyObject *ObjectMeshAsPyList(ObjectMesh * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int allMapsExist = ObjectMeshAllMapsInStatesExist(I); @@ -340,7 +340,7 @@ void ObjectMesh::invalidate(cRep_t rep, cRepInv_t level, int state) } if((rep == cRepMesh) || (rep == cRepAll) || (rep == cRepCell)) { - for(StateIterator iter(I->G, NULL, state, I->NState); iter.next();) { + for(StateIterator iter(I->G, nullptr, state, I->NState); iter.next();) { ObjectMeshState *ms = &I->State[iter.state]; ms->shaderCGO.reset(); @@ -383,7 +383,7 @@ int ObjectMeshSetLevel(ObjectMesh * I, float level, int state, int quiet) if(state >= I->NState) { ok = false; } else { - for(StateIterator iter(I->G, NULL, state, I->NState); iter.next();) { + for(StateIterator iter(I->G, nullptr, state, I->NState); iter.next();) { ObjectMeshState *ms = &I->State[iter.state]; if(ms->Active) { ms->ResurfaceFlag = true; @@ -402,9 +402,9 @@ static void ObjectMeshStateUpdateColors(ObjectMesh * I, ObjectMeshState * ms) int cur_color = -1; if(ms->MeshMode == cIsomeshMode::isomesh) { - cur_color = SettingGet_color(I->G, I->Setting.get(), NULL, cSetting_mesh_color); + cur_color = SettingGet_color(I->G, I->Setting.get(), nullptr, cSetting_mesh_color); } else if(ms->MeshMode == cIsomeshMode::isodot) { - cur_color = SettingGet_color(I->G, I->Setting.get(), NULL, cSetting_dot_color); + cur_color = SettingGet_color(I->G, I->Setting.get(), nullptr, cSetting_dot_color); } if(cur_color == -1) @@ -442,7 +442,7 @@ static void ObjectMeshStateUpdateColors(ObjectMesh * I, ObjectMeshState * ms) for(a = 0; a < n_vert; a++) { if(a == base_n_vert) { int new_color = SettingGet_color(I->G, I->Setting.get(), - NULL, cSetting_mesh_negative_color); + nullptr, cSetting_mesh_negative_color); if(new_color == -1) new_color = cur_color; if(new_color != cur_color) { @@ -469,7 +469,7 @@ static void ObjectMeshStateUpdateColors(ObjectMesh * I, ObjectMeshState * ms) ms->RC.clear(); } else if((!ramped_flag) || - (!SettingGet_b(I->G, NULL, I->Setting.get(), cSetting_ray_color_ramps))) { + (!SettingGet_b(I->G, nullptr, I->Setting.get(), cSetting_ray_color_ramps))) { ms->RC.clear(); } } @@ -481,8 +481,8 @@ void ObjectMesh::update() int a; int c; ObjectMeshState *ms; - ObjectMapState *oms = NULL; - ObjectMap *map = NULL; + ObjectMapState *oms = nullptr; + ObjectMap *map = nullptr; int *n; float *v; @@ -491,7 +491,7 @@ void ObjectMesh::update() int n_line; int flag; int last_flag = 0; - int mesh_skip = SettingGet_i(G, I->Setting.get(), NULL, cSetting_mesh_skip); + int mesh_skip = SettingGet_i(G, I->Setting.get(), nullptr, cSetting_mesh_skip); for(a = 0; a < I->NState; a++) { ms = &I->State[a]; @@ -528,7 +528,7 @@ void ObjectMesh::update() if(map && oms && ms->N && ms->V && (I->visRep & cRepMeshBit)) { if(ms->ResurfaceFlag) { - Isofield *field = NULL; + Isofield *field = nullptr; ms->RecolorFlag = true; ms->ResurfaceFlag = false; if(!ms->quiet) { @@ -565,14 +565,14 @@ void ObjectMesh::update() ms->Range[3], ms->Range[4], ms->Range[5]); */ - IsosurfVolume(I->G, I->Setting.get(), NULL, + IsosurfVolume(I->G, I->Setting.get(), nullptr, field, ms->Level, ms->N, ms->V, ms->Range, ms->MeshMode, mesh_skip, ms->AltLevel); if(!SettingGet_b - (I->G, I->Setting.get(), NULL, cSetting_mesh_negative_visible)) { + (I->G, I->Setting.get(), nullptr, cSetting_mesh_negative_visible)) { ms->base_n_V = VLAGetSize(ms->V); } else if(ms->MeshMode != cIsomeshMode::gradient) { /* do we want the negative surface too? */ @@ -580,7 +580,7 @@ void ObjectMesh::update() pymol::vla N2(10000); pymol::vla V2(10000); - IsosurfVolume(I->G, I->Setting.get(), NULL, + IsosurfVolume(I->G, I->Setting.get(), nullptr, field, -ms->Level, N2, V2, ms->Range, ms->MeshMode, mesh_skip, ms->AltLevel); @@ -722,7 +722,7 @@ static short ObjectMeshStateRenderShader(ObjectMeshState *ms, ObjectMesh *I, SceneGetTwoSidedLighting(G)); } - CGORender(ms->shaderCGO.get(), NULL, NULL, NULL, info, NULL); + CGORender(ms->shaderCGO.get(), nullptr, nullptr, nullptr, info, nullptr); if (shaderPrg) { shaderPrg->Disable(); @@ -731,7 +731,7 @@ static short ObjectMeshStateRenderShader(ObjectMeshState *ms, ObjectMesh *I, if (ms->shaderUnitCellCGO){ shaderPrg = G->ShaderMgr->Enable_DefaultShader(info->pass); shaderPrg->SetLightingEnabled(0); - CGORender(ms->shaderUnitCellCGO.get(), NULL, NULL, NULL, info, NULL); + CGORender(ms->shaderUnitCellCGO.get(), nullptr, nullptr, nullptr, info, nullptr); shaderPrg->Disable(); } @@ -741,7 +741,7 @@ static short ObjectMeshStateRenderShader(ObjectMeshState *ms, ObjectMesh *I, static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCGO, int stateArg) { PyMOLGlobals *G = I->G; - float *v = NULL; + float *v = nullptr; float *vc; int *rc; float radius; @@ -749,10 +749,10 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG CRay *ray = 0; bool pick = false; RenderPass pass = RenderPass::Antialias; - int *n = NULL; + int *n = nullptr; int c; - float line_width, mesh_width = SettingGet_f(I->G, I->Setting.get(), NULL, cSetting_mesh_width); - ObjectMeshState *ms = NULL; + float line_width, mesh_width = SettingGet_f(I->G, I->Setting.get(), nullptr, cSetting_mesh_width); + ObjectMeshState *ms = nullptr; int ok = true; if (info){ @@ -782,23 +782,23 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG if(ok && ray) { if(ms->UnitCellCGO && (I->visRep & cRepCellBit)){ ok &= CGORenderRay(ms->UnitCellCGO.get(), ray, info, ColorGet(I->G, I->Color), - NULL, I->Setting.get(), NULL); + nullptr, I->Setting.get(), nullptr); if (!ok){ ms->UnitCellCGO.reset(); break; } } if(ms->MeshMode != cIsomeshMode::isodot) { - radius = SettingGet_f(I->G, I->Setting.get(), NULL, cSetting_mesh_radius); + radius = SettingGet_f(I->G, I->Setting.get(), nullptr, cSetting_mesh_radius); if(radius == 0.0F) { radius = ray->PixelRadius * line_width / 2.0F; } } else { - radius = SettingGet_f(I->G, I->Setting.get(), NULL, cSetting_dot_radius); + radius = SettingGet_f(I->G, I->Setting.get(), nullptr, cSetting_dot_radius); if(radius == 0.0F) { radius = - ray->PixelRadius * SettingGet_f(I->G, I->Setting.get(), NULL, + ray->PixelRadius * SettingGet_f(I->G, I->Setting.get(), nullptr, cSetting_dot_width) / 1.4142F; } } @@ -868,7 +868,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG if(!pick && pass == RenderPass::Antialias) { short use_shader; short mesh_as_cylinders ; - CGO *shaderCGO = NULL; + CGO *shaderCGO = nullptr; use_shader = ( SettingGetGlobal_b(G, cSetting_mesh_use_shader) & SettingGetGlobal_b(G, cSetting_use_shaders)) | returnCGO; mesh_as_cylinders = SettingGetGlobal_b(G, cSetting_render_as_cylinders) && @@ -898,7 +898,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG if(ms->UnitCellCGO && (I->visRep & cRepCellBit)) { const float *color = ColorGet(I->G, I->Color); if (!use_shader) { - CGORender(ms->UnitCellCGO.get(), color, I->Setting.get(), NULL, info, NULL); + CGORender(ms->UnitCellCGO.get(), color, I->Setting.get(), nullptr, info, nullptr); } else if(!ms->shaderUnitCellCGO) { CGO *newUnitCellCGO = CGONewSized(G, 0); CGOColorv(newUnitCellCGO, color); @@ -934,7 +934,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG if (!mesh_as_cylinders){ if(ms->MeshMode == cIsomeshMode::isodot){ ok &= CGODotwidth(shaderCGO, SettingGet_f - (I->G, I->Setting.get(), NULL, cSetting_dot_width)); + (I->G, I->Setting.get(), nullptr, cSetting_dot_width)); } else { ok &= CGOSpecial(shaderCGO, LINEWIDTH_DYNAMIC_MESH); } @@ -1002,7 +1002,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG glColor3fv(ColorGet(I->G, ms->OneColor)); if(ms->MeshMode == cIsomeshMode::isodot){ glPointSize(SettingGet_f - (I->G, I->Setting.get(), NULL, cSetting_dot_width)); + (I->G, I->Setting.get(), nullptr, cSetting_dot_width)); } else { glLineWidth(line_width); } @@ -1035,7 +1035,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG if (use_shader) { if (ok){ - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; if (ok) ok &= CGOStop(shaderCGO); if (ok) @@ -1061,7 +1061,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG convertcgo = tmpCGO; convertcgo->use_shader = convertcgo->has_draw_cylinder_buffers = true; } else { - convertcgo = CGOOptimizeToVBONotIndexedWithReturnedData(ms->shaderCGO.get(), 0, false, NULL); + convertcgo = CGOOptimizeToVBONotIndexedWithReturnedData(ms->shaderCGO.get(), 0, false, nullptr); } CHECKOK(ok, convertcgo); } @@ -1084,7 +1084,7 @@ static CGO *ObjectMeshRenderImpl(ObjectMesh * I, RenderInfo * info, int returnCG ObjectSetRepVisMask(I, 0, cVis_AS); } - return NULL; + return nullptr; } @@ -1123,9 +1123,9 @@ ObjectMesh *ObjectMeshFromXtalSym(PyMOLGlobals * G, ObjectMesh * obj, ObjectMap float alt_level, int quiet) { int ok = true; - ObjectMesh *I = NULL; - ObjectMeshState *ms = NULL; - ObjectMapState *oms = NULL; + ObjectMesh *I = nullptr; + ObjectMeshState *ms = nullptr; + ObjectMapState *oms = nullptr; int created = !obj; if(created) { @@ -1271,7 +1271,7 @@ ObjectMesh *ObjectMeshFromBox(PyMOLGlobals * G, ObjectMesh * obj, ObjectMap * ma float level, cIsomeshMode meshMode, float carve, float *vert_vla, float alt_level, int quiet) { - return ObjectMeshFromXtalSym(G, obj, map, NULL, map_state, state, mn, mx, + return ObjectMeshFromXtalSym(G, obj, map, nullptr, map_state, state, mn, mx, level, meshMode, carve, vert_vla, alt_level, quiet); } diff --git a/layer2/ObjectMolecule.cpp b/layer2/ObjectMolecule.cpp index 1f6f23bc4..1e6f3b9ec 100644 --- a/layer2/ObjectMolecule.cpp +++ b/layer2/ObjectMolecule.cpp @@ -225,8 +225,8 @@ int ObjectMoleculeSetDiscrete(PyMOLGlobals * G, ObjectMolecule * I, int discrete { int state, idx, ao, an, ao1, ao2, an1, an2; int maxnatom, natom = I->NAtom, nbond = I->NBond; - int *aostate2an = NULL; - char *bondseen = NULL; + int *aostate2an = nullptr; + char *bondseen = nullptr; BondType *bond; CoordSet *cs; @@ -390,7 +390,7 @@ char *ObjectMolecule::getCaption(char * ch, int len) const const char *frozen_str = ""; int state = ObjectGetCurrentState(I, false); - int counter_mode = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_state_counter_mode); + int counter_mode = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_state_counter_mode); int frozen = SettingGetIfDefined_i(I->G, I->Setting.get(), cSetting_state, &objState); /* if frozen print (blue) STATE / NSTATES @@ -425,7 +425,7 @@ char *ObjectMolecule::getCaption(char * ch, int len) const /* bail on null string or no room */ if (!ch || len==0) - return NULL; + return nullptr; ch[0] = 0; @@ -471,7 +471,7 @@ char *ObjectMolecule::getCaption(char * ch, int len) const } if (n > len) - return NULL; + return nullptr; return ch; } @@ -648,7 +648,7 @@ int ObjectMoleculeXferValences(ObjectMolecule * Ia, int sele1, int sele2, int target_state, ObjectMolecule * Ib, int sele3, int source_state, int quiet) { - int *matched = NULL; + int *matched = nullptr; int match_found = false; PyMOLGlobals *G = Ia->G; if(Ia == Ib) @@ -742,7 +742,7 @@ void ObjectMoleculeTransformState44f(ObjectMolecule * I, int state, const float int a; float tmp_matrix[16]; CoordSet *cs; - int use_matrices = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_matrix_mode); + int use_matrices = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; if(!use_matrices) { ObjectMoleculeTransformSelection(I, state, -1, matrix, log_trans, I->Name, @@ -772,7 +772,7 @@ void ObjectMoleculeTransformState44f(ObjectMolecule * I, int state, const float ObjectStateLeftCombineMatrixR44d(cs, dbl_matrix); } else if(I->NCSet == 1) { /* static singleton state */ cs = I->CSet[0]; - if(cs && SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_static_singletons)) { + if(cs && SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_static_singletons)) { ObjectStateLeftCombineMatrixR44d(cs, dbl_matrix); } } @@ -906,7 +906,7 @@ int ObjectMoleculeGetTopNeighbor(PyMOLGlobals * G, * @param[in] obj Object Molecule for evaluation of the selection * @param[in,out] cs Candidate coordinate set (with valid index arrays) * @param[in] selection Named selection - * @return index mapping, or NULL if `selection` is not valid + * @return index mapping, or nullptr if `selection` is not valid */ std::unique_ptr LoadTrajSeleHelper( const ObjectMolecule* obj, CoordSet* cs, const char* selection) @@ -962,7 +962,7 @@ ObjectMolecule *ObjectMoleculeLoadTRJFile(PyMOLGlobals * G, ObjectMolecule * I, float box[3], angle[3]; float r_cent[3], r_trans[3]; int r_act, r_val, r_cnt; - float *r_fp_start = NULL, *r_fp_stop = NULL; + float *r_fp_start = nullptr, *r_fp_stop = nullptr; int a, b, c, i; int zoom_flag = false; int cnt = 0; @@ -970,7 +970,7 @@ ObjectMolecule *ObjectMoleculeLoadTRJFile(PyMOLGlobals * G, ObjectMolecule * I, int icnt; int ncnt = 0; float zerovector[3] = { 0.0, 0.0, 0.0 }; - CoordSet *cs = NULL; + CoordSet *cs = nullptr; if (I->DiscreteFlag) { PRINTFB(G, FB_ObjectMolecule, FB_Errors) @@ -1049,7 +1049,7 @@ ObjectMolecule *ObjectMoleculeLoadTRJFile(PyMOLGlobals * G, ObjectMolecule * I, if(xref[a] >= 0) fp = cs->coordPtr(xref[a]); else - fp = NULL; + fp = nullptr; } else { fp = cs->coordPtr(a); } @@ -1169,7 +1169,7 @@ ObjectMolecule *ObjectMoleculeLoadTRJFile(PyMOLGlobals * G, ObjectMolecule * I, if(xref[i] >= 0) fp = cs->coordPtr(xref[i]); else - fp = NULL; + fp = nullptr; } else { fp = cs->coordPtr(i); } @@ -1306,7 +1306,7 @@ ObjectMolecule *ObjectMoleculeLoadRSTFile(PyMOLGlobals * G, ObjectMolecule * I, float f0, f1, f2, *fp; int a, b, c; int zoom_flag = false; - CoordSet *cs = NULL; + CoordSet *cs = nullptr; char ncolumn = 6; // number of coordinates per line char nbyte = 12; // width of one coordinate @@ -1332,7 +1332,7 @@ ObjectMolecule *ObjectMoleculeLoadRSTFile(PyMOLGlobals * G, ObjectMolecule * I, if (ok){ PRINTFB(G, FB_ObjectMolecule, FB_Blather) " ObjMolLoadRSTFile: Loading from \"%s\".\n", fname ENDFB(G); - p = buffer = FileGetContents(fname, NULL); + p = buffer = FileGetContents(fname, nullptr); if(!buffer) ok = ErrMessage(G, __func__, "Unable to open file!"); } @@ -1473,11 +1473,11 @@ static CoordSet *ObjectMoleculeTOPStr2CoordSet(PyMOLGlobals * G, const char *buf const char *p; int nAtom; int a, b, c, bi, last_i, at_i, aa, rc; - float *coord = NULL; + float *coord = nullptr; float *f; - CoordSet *cset = NULL; - AtomInfoType *atInfo = NULL, *ai; - BondType *bond = NULL, *bd; + CoordSet *cset = nullptr; + AtomInfoType *atInfo = nullptr, *ai; + BondType *bond = nullptr, *bd; int nBond = 0; int auto_show = RepGetAutoShowMask(G); int amber7 = false; @@ -2315,7 +2315,7 @@ static CoordSet *ObjectMoleculeTOPStr2CoordSet(PyMOLGlobals * G, const char *buf } else { ok_except1: delete cset; - cset = NULL; + cset = nullptr; ErrMessage(G, __func__, "failed"); } if(atInfoPtr) @@ -2329,7 +2329,7 @@ static CoordSet *ObjectMoleculeTOPStr2CoordSet(PyMOLGlobals * G, const char *buf static ObjectMolecule *ObjectMoleculeReadTOPStr(PyMOLGlobals * G, ObjectMolecule * I, char *TOPStr, int frame, int discrete) { - CoordSet *cset = NULL; + CoordSet *cset = nullptr; pymol::vla atInfo(1); int ok = true; int isNew = true; @@ -2416,10 +2416,10 @@ static ObjectMolecule *ObjectMoleculeReadTOPStr(PyMOLGlobals * G, ObjectMolecule ObjectMolecule *ObjectMoleculeLoadTOPFile(PyMOLGlobals * G, ObjectMolecule * obj, const char *fname, int frame, int discrete) { - ObjectMolecule *I = NULL; + ObjectMolecule *I = nullptr; char *buffer; - buffer = FileGetContents(fname, NULL); + buffer = FileGetContents(fname, nullptr); if(!buffer) ErrMessage(G, __func__, "Unable to open file!"); @@ -2724,14 +2724,14 @@ void ObjectMoleculeRenderSele(ObjectMolecule * I, int curState, int sele, int vi int flag = true; int all_vis = !vis_only; int visRep; - float tmp_matrix[16], v_tmp[3], *matrix = NULL; + float tmp_matrix[16], v_tmp[3], *matrix = nullptr; int use_matrices = - SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_matrix_mode); + SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; if (SettingGetIfDefined_i(G, I->Setting.get(), cSetting_all_states, &a)) { - curState = a ? -1 : SettingGet_i(G, I->Setting.get(), NULL, cSetting_state); + curState = a ? -1 : SettingGet_i(G, I->Setting.get(), nullptr, cSetting_state); } else if (SettingGetIfDefined_i(G, I->Setting.get(), cSetting_state, &a)) { curState = a - 1; } @@ -2749,7 +2749,7 @@ void ObjectMoleculeRenderSele(ObjectMolecule * I, int curState, int sele, int vi copy44d44f(cs->Matrix.data(), tmp_matrix); matrix = tmp_matrix; } else - matrix = NULL; + matrix = nullptr; if(I->TTTFlag) { if(!matrix) { @@ -2805,12 +2805,12 @@ static CoordSet *ObjectMoleculeXYZStr2CoordSet(PyMOLGlobals * G, const char *buf const char *p, *p_store; int nAtom; int a, c; - float *coord = NULL; - CoordSet *cset = NULL; - AtomInfoType *atInfo = NULL, *ai; + float *coord = nullptr; + CoordSet *cset = nullptr; + AtomInfoType *atInfo = nullptr, *ai; char cc[MAXLINELEN]; int atomCount; - BondType *bond = NULL; + BondType *bond = nullptr; int nBond = 0; int b1, b2; WordType tmp_name; @@ -3108,7 +3108,7 @@ int ObjectMoleculeRenameAtoms(ObjectMolecule * I, int *flag, int force) } } } - result = AtomInfoUniquefyNames(I->G, NULL, 0, I->AtomInfo.data(), flag, I->NAtom); + result = AtomInfoUniquefyNames(I->G, nullptr, 0, I->AtomInfo.data(), flag, I->NAtom); return result; } @@ -3120,7 +3120,7 @@ int ObjectMoleculeRenameAtoms(ObjectMolecule * I, int *flag, int force) * @param coord_orig Original cs coordinates * @param at0 Anchor atom index * @param mat1_inv Source coordinate system - * @param valence_vec Valence vector. If NULL, don't move. If null-vector, don't merge. + * @param valence_vec Valence vector. If nullptr, don't move. If null-vector, don't merge. */ static bool AddCoordinateIntoCoordSet(CoordSet* tcs, CoordSet* cs, const float* coord_orig, int at0, const float* mat1_inv, @@ -3491,7 +3491,7 @@ int ObjectMoleculeAttach(ObjectMolecule * I, int index, AtomInfoType *ai; BondType* bond; float v[3], v0[3], d; - CoordSet *cs = NULL; + CoordSet *cs = nullptr; int ok = false; ai = I->AtomInfo + index; @@ -3542,7 +3542,7 @@ int ObjectMoleculeFillOpenValences(ObjectMolecule * I, int index) int result = 0; int flag = true; float v[3], v0[3], d; - CoordSet *cs = NULL; + CoordSet *cs = nullptr; int ok = true; if((index >= 0) && (index <= I->NAtom)) { @@ -3671,7 +3671,7 @@ static bool get_planer_normal(const CoordSet* cs, int const atm, float* normal) /** * @param atm Atom index * @param[out] v (3x1) Normalized open valence vector - * @param seek (3x1) Primer for the direction, or NULL for random priming. + * @param seek (3x1) Primer for the direction, or nullptr for random priming. * @param ignore_index Atom index of neighbor to ignore * @return True if valid open valence vector found */ @@ -3855,16 +3855,16 @@ void ObjectMoleculeCreateSpheroid(ObjectMolecule * I, int average) SphereRec *sp; float *v, *v0, *s, *f, ang, min_dist, *max_sq; int *i; - float *center = NULL; + float *center = nullptr; float d0[3], n0[3], d1[3], d2[3]; float p0[3], p1[3], p2[3]; int t0, t1, t2, bt0, bt1, bt2; - float dp, l, *fsum = NULL; + float dp, l, *fsum = nullptr; float spheroid_smooth; float spheroid_fill; float spheroid_ratio = 0.1F; /* minimum ratio of width over length */ float spheroid_minimum = 0.02F; /* minimum size - to insure valid normals */ - int row, *count = NULL, base; + int row, *count = nullptr, base; int nRow; int first = 0; int last = 0; @@ -4068,12 +4068,12 @@ void ObjectMoleculeCreateSpheroid(ObjectMolecule * I, int average) for(b = first + 1; b < last; b++) { delete I->CSet[b]; - I->CSet[b] = NULL; + I->CSet[b] = nullptr; } if(n_state != first) { I->CSet[n_state] = I->CSet[first]; - I->CSet[first] = NULL; + I->CSet[first] = nullptr; } n_state++; @@ -4134,7 +4134,7 @@ int ObjectMoleculePrepareAtom(ObjectMolecule * I, int index, AtomInfoType * ai, AtomInfoAssignParameters(I->G, ai); if (uniquefy) { - AtomInfoUniquefyNames(I->G, I->AtomInfo, I->NAtom, ai, NULL, 1); + AtomInfoUniquefyNames(I->G, I->AtomInfo, I->NAtom, ai, nullptr, 1); } if((ai->elem[0] == ai0->elem[0]) && (ai->elem[1] == ai0->elem[1])) @@ -4409,7 +4409,7 @@ int ObjectMoleculeAdjustBonds(ObjectMolecule * I, int sele0, int sele1, int mode cnt++; switch (mode) { case 0: /* cycle */ - switch(SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_editor_bond_cycle_mode)) { + switch(SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_editor_bond_cycle_mode)) { case 1: /* 1 arom 2 3 */ switch(b0->order) { case 1: @@ -4810,10 +4810,10 @@ void ObjectMoleculeGuessValences(ObjectMolecule * I, int state, int *flag1, int better than nothing! */ const float planer_cutoff = 0.96F; - CoordSet *cs = NULL; - ObservedInfo *obs_atom = NULL; - ObservedInfo *obs_bond = NULL; - int *flag = NULL; + CoordSet *cs = nullptr; + ObservedInfo *obs_atom = nullptr; + ObservedInfo *obs_bond = nullptr; + int *flag = nullptr; int warning1 = 0, warning2 = 0; /* WORKAROUND of a possible -funroll-loops inlining optimizer bug in gcc 3.3.3 */ @@ -5032,7 +5032,7 @@ void ObjectMoleculeGuessValences(ObjectMolecule * I, int state, int *flag1, int float n1_len = 0.0F, n2_len = 0.0F, n3_len = 0.0F; int c1_at = -1, c2_at = -1; float c1_v[3] = { 0.0F, 0.0F, 0.0F }; - float *v0 = NULL; + float *v0 = nullptr; { int idx0 = cs->atmToIdx(a); @@ -5042,7 +5042,7 @@ void ObjectMoleculeGuessValences(ObjectMolecule * I, int state, int *flag1, int { int i; for(i = 1; i <= nn; i++) { - float *v1 = NULL; + float *v1 = nullptr; { int idx1 = cs->atmToIdx(atm[i]); @@ -5963,7 +5963,7 @@ void ObjectMoleculeInferChemFromBonds(ObjectMolecule * I, int state) int a, b; const BondType *b0; - AtomInfoType *ai, *ai0, *ai1 = NULL; + AtomInfoType *ai, *ai0, *ai1 = nullptr; int a0, a1; int expect, order; int changedFlag; @@ -6264,7 +6264,7 @@ int ObjectMoleculeTransformSelection(ObjectMolecule * I, int state, cs = I->CSet[state]; if(cs) { int use_matrices = SettingGet_i(G, I->Setting.get(), - NULL, cSetting_matrix_mode); + nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; if(global &&!homogenous) { /* convert matrix to homogenous */ @@ -6449,7 +6449,7 @@ void ObjectMoleculeUpdateNonbonded(ObjectMolecule * I) * * Changed in PyMOL 2.1.1: Ignore zero-order bonds (PYMOL-3025) * - * @return Pointer to cached array, or NULL if memory allocation failed + * @return Pointer to cached array, or nullptr if memory allocation failed * * @verbatim 0 list offset for atom 0 = n @@ -6568,22 +6568,22 @@ static CoordSet *ObjectMoleculeChemPyModel2CoordSet(PyMOLGlobals * G, { int nAtom, nBond; int a, c; - float *coord = NULL; - CoordSet *cset = NULL; - AtomInfoType *atInfo = NULL, *ai; + float *coord = nullptr; + CoordSet *cset = nullptr; + AtomInfoType *atInfo = nullptr, *ai; float *f; - BondType *ii, *bond = NULL; + BondType *ii, *bond = nullptr; int ok = true; int auto_show = RepGetAutoShowMask(G); int hetatm; int ignore_ids; - PyObject *atomList = NULL; - PyObject *bondList = NULL; - PyObject *atom = NULL; - PyObject *bnd = NULL; - PyObject *index = NULL; - PyObject *crd = NULL; - PyObject *tmp = NULL; + PyObject *atomList = nullptr; + PyObject *bondList = nullptr; + PyObject *atom = nullptr; + PyObject *bnd = nullptr; + PyObject *index = nullptr; + PyObject *crd = nullptr; + PyObject *tmp = nullptr; ignore_ids = !SettingGetGlobal_b(G, cSetting_preserve_chempy_ids); @@ -7209,9 +7209,9 @@ ObjectMolecule *ObjectMoleculeLoadChemPyModel(PyMOLGlobals * G, PyObject * model, int frame, int discrete) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else - CoordSet *cset = NULL; + CoordSet *cset = nullptr; auto atInfo = pymol::vla(10); int ok = true; int isNew = true; @@ -7277,7 +7277,7 @@ ObjectMolecule *ObjectMoleculeLoadChemPyModel(PyMOLGlobals * G, if(symmetry) { tmp = PyObject_GetAttrString(model, "spacegroup"); if(tmp) { - const char *tmp_str = NULL; + const char *tmp_str = nullptr; if(PConvPyStrToStrPtr(tmp, &tmp_str)) { symmetry->setSpaceGroup(tmp_str); } @@ -7383,7 +7383,7 @@ ObjectMolecule *ObjectMoleculeLoadChemPyModel(PyMOLGlobals * G, ObjectMolecule *ObjectMoleculeLoadCoords(PyMOLGlobals * G, ObjectMolecule * I, const float * coords, int coords_len, int frame) { - CoordSet *cset = NULL; + CoordSet *cset = nullptr; int a; bool is_new = false; @@ -7435,7 +7435,7 @@ ObjectMolecule *ObjectMoleculeLoadCoords(PyMOLGlobals * G, ObjectMolecule * I, if(is_new && cset) delete cset; ErrMessage(G, "LoadCoords", "failed"); - return NULL; + return nullptr; } /*========================================================================*/ @@ -7448,7 +7448,7 @@ ObjectMolecule *ObjectMoleculeLoadCoords(PyMOLGlobals * G, const char * name, if(!cobj || cobj->type != cObjectMolecule) { ErrMessage(G, "LoadCoords", "named object molecule not found."); - return NULL; + return nullptr; } return ObjectMoleculeLoadCoords(G, (ObjectMolecule *) cobj, @@ -7465,9 +7465,9 @@ ObjectMolecule *ObjectMoleculeLoadCoords(PyMOLGlobals * G, ObjectMolecule * I, PyObject * coords, int frame) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else - CoordSet *cset = NULL; + CoordSet *cset = nullptr; int a, b, l; PyObject *v, *w; float *f; @@ -7541,7 +7541,7 @@ ObjectMolecule *ObjectMoleculeLoadCoords(PyMOLGlobals * G, ObjectMolecule * I, if(is_new && cset) delete cset; ErrMessage(G, "LoadCoords", "failed"); - return NULL; + return nullptr; #endif } @@ -7581,13 +7581,13 @@ static CoordSet *ObjectMoleculeMOLStr2CoordSet(PyMOLGlobals * G, const char *buf const char *p; int nAtom, nBond; int a, cnt, atm, chg; - float *coord = NULL; - CoordSet *cset = NULL; - AtomInfoType *atInfo = NULL; + float *coord = nullptr; + CoordSet *cset = nullptr; + AtomInfoType *atInfo = nullptr; char cc[MAXLINELEN], cc1[MAXLINELEN], resn[MAXLINELEN] = "UNK"; float *f; BondType *ii; - BondType *bond = NULL; + BondType *bond = nullptr; int ok = true; int auto_show = RepGetAutoShowMask(G); WordType nameTmp; @@ -7767,7 +7767,7 @@ static CoordSet *ObjectMoleculeMOLStr2CoordSet(PyMOLGlobals * G, const char *buf } else { VLAFreeP(bond); VLAFreeP(coord); - (*restart) = NULL; + (*restart) = nullptr; } if(atInfoPtr) *atInfoPtr = atInfo; @@ -7783,7 +7783,7 @@ static CoordSet *ObjectMoleculeSDF2Str2CoordSet(PyMOLGlobals * G, const char *bu { char cc[MAXLINELEN]; const char *p; - CoordSet *result = NULL; + CoordSet *result = nullptr; result = ObjectMoleculeMOLStr2CoordSet(G, buffer, atInfoPtr, next_mol); p = *next_mol; if(p) { @@ -7795,7 +7795,7 @@ static CoordSet *ObjectMoleculeSDF2Str2CoordSet(PyMOLGlobals * G, const char *bu } } if(!*p) - p = NULL; + p = nullptr; } *next_mol = p; return result; @@ -7926,14 +7926,14 @@ static CoordSet *ObjectMoleculeMOL2Str2CoordSet(PyMOLGlobals * G, const char *p; int nAtom, nBond, nSubst, nFeat, nSet; int a; - float *coord = NULL; - CoordSet *cset = NULL; - AtomInfoType *atInfo = NULL; + float *coord = nullptr; + CoordSet *cset = nullptr; + AtomInfoType *atInfo = nullptr; char cc[MAXLINELEN]; float *f; const char *last_p; BondType *ii; - BondType *bond = NULL; + BondType *bond = nullptr; int ok = true; int auto_show = RepGetAutoShowMask(G); int have_molecule = false; @@ -8517,11 +8517,11 @@ ObjectMolecule *ObjectMoleculeReadStr(PyMOLGlobals * G, ObjectMolecule * I, short loadpropertiesall, OVLexicon *loadproplex) { int ok = true; - CoordSet *cset = NULL; + CoordSet *cset = nullptr; pymol::vla atInfo; int isNew; int nAtom; - const char *restart = NULL, *start = *next_entry; + const char *restart = nullptr, *start = *next_entry; int repeatFlag = true; int successCnt = 0; char tmpName[WordLength]; @@ -8529,7 +8529,7 @@ ObjectMolecule *ObjectMoleculeReadStr(PyMOLGlobals * G, ObjectMolecule * I, int skip_out; int connect = false; int set_formal_charges = false; - *next_entry = NULL; + *next_entry = nullptr; int aic_mask = cAIC_MOLMask; while(repeatFlag) { @@ -8552,7 +8552,7 @@ ObjectMolecule *ObjectMoleculeReadStr(PyMOLGlobals * G, ObjectMolecule * I, I->Color = AtomInfoUpdateAutoColor(G); } - restart = NULL; + restart = nullptr; switch (content_format) { case cLoadTypeMOL2: case cLoadTypeMOL2Str: @@ -8564,7 +8564,7 @@ ObjectMolecule *ObjectMoleculeReadStr(PyMOLGlobals * G, ObjectMolecule * I, case cLoadTypeMOL: case cLoadTypeMOLStr: cset = ObjectMoleculeMOLStr2CoordSet(G, start, &atInfo, &restart); - restart = NULL; + restart = nullptr; break; case cLoadTypeSDF2: case cLoadTypeSDF2Str: @@ -8938,7 +8938,7 @@ int ObjectMoleculeMerge(ObjectMolecule * I, pymol::vla&& ai, /*========================================================================*/ /** * @param state Object state or -2 for current state - * @return NULL if there is no CoordSet for the given state + * @return nullptr if there is no CoordSet for the given state */ CoordSet* ObjectMolecule::getCoordSet(int state) { @@ -9015,7 +9015,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op if (op->s1 && op->s1[0]){ #ifndef _PYMOL_NOPY expr_co = Py_CompileString(op->s1, "", compileType); - if(expr_co == NULL) { + if(expr_co == nullptr) { ok = ErrMessage(G, errstr, "failed to compile expression"); } #else @@ -9183,7 +9183,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op } if(op_i2) { use_matrices = - SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_matrix_mode); + SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; } for(a = 0; a < I->NAtom; a++) { @@ -9308,9 +9308,9 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op } if(op->nvv1) { if(op->i1 != 0) /* fitting flag */ - rms = MatrixFitRMSTTTf(G, op->nvv1, op->vv1, vt, NULL, op->ttt); + rms = MatrixFitRMSTTTf(G, op->nvv1, op->vv1, vt, nullptr, op->ttt); else - rms = MatrixGetRMS(G, op->nvv1, op->vv1, vt, NULL); + rms = MatrixGetRMS(G, op->nvv1, op->vv1, vt, nullptr); if(op->i1 == 2) { ObjectMoleculeTransformTTTf(I, op->ttt, b); @@ -9520,7 +9520,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op case OMOP_Spectrum: ai = I->AtomInfo.data(); - ai0 = NULL; + ai0 = nullptr; for(a = 0; a < I->NAtom; a++) { s = ai->selEntry; if(SelectorIsMember(G, s, sele)) { @@ -9663,7 +9663,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op CoordSet* const* i_CSet = I->CSet.data(); if(op_i2) { use_matrices = - SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_matrix_mode); + SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; } ai = I->AtomInfo.data(); @@ -9723,7 +9723,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op CoordSet* const* i_CSet = I->CSet.data(); if(op_i2) { use_matrices = - SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_matrix_mode); + SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; } ai = I->AtomInfo.data(); @@ -9801,7 +9801,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op } break; } - use_matrices = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_matrix_mode); + use_matrices = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; ai = I->AtomInfo.data(); @@ -9898,7 +9898,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op case cExecutiveLabelEvalOn: { /* python label expression evaluation */ - CoordSet *cs = NULL; + CoordSet *cs = nullptr; if(I->DiscreteFlag && I->DiscreteCSet) { cs = I->DiscreteCSet[a]; } else if (I->NCSet == 1){ @@ -9946,7 +9946,7 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op break; case OMOP_ALTR: if(ok) { - CoordSet *cs = NULL; + CoordSet *cs = nullptr; if(I->DiscreteFlag && I->DiscreteCSet) { cs = I->DiscreteCSet[a]; } else if (I->NCSet == 1){ @@ -9998,12 +9998,12 @@ bool ObjectMoleculeSeleOp(ObjectMolecule * I, int sele, ObjectMoleculeOpRec * op case OMOP_CSetSumSqDistToPt: case OMOP_CSetSumVertices: case OMOP_CSetMoment: - cs = NULL; + cs = nullptr; if((op->cs1 >= 0) && (op->cs1 < I->NCSet)) { cs = I->CSet[op->cs1]; } else if(op->include_static_singletons) { if((I->NCSet == 1) - && (SettingGet_b(G, NULL, I->Setting.get(), cSetting_static_singletons))) { + && (SettingGet_b(G, nullptr, I->Setting.get(), cSetting_static_singletons))) { cs = I->CSet[0]; /*treat static singletons as present in each state */ } } @@ -10578,7 +10578,7 @@ void ObjectMolecule::update() /* set start and stop given an object */ ObjectAdjustStateRebuildRange(I, &start, &stop); if((I->NCSet == 1) - && (SettingGet_b(G, I->Setting.get(), NULL, cSetting_static_singletons))) { + && (SettingGet_b(G, I->Setting.get(), nullptr, cSetting_static_singletons))) { start = 0; stop = 1; } @@ -10739,7 +10739,7 @@ int ObjectMoleculeMoveAtom(ObjectMolecule * I, int state, int index, const float if(I->NCSet == 1) state = 0; state = state % I->NCSet; - if((!I->CSet[state]) && (SettingGet_b(G, I->Setting.get(), NULL, cSetting_all_states))) + if((!I->CSet[state]) && (SettingGet_b(G, I->Setting.get(), nullptr, cSetting_all_states))) state = 0; cs = I->CSet[state]; if(cs) { @@ -10773,7 +10773,7 @@ int ObjectMoleculeMoveAtomLabel(ObjectMolecule * I, int state, int index, float state = 0; state = state % I->NCSet; if((!I->CSet[state]) - && (SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_all_states))) + && (SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_all_states))) state = 0; cs = I->CSet[state]; if(cs) { @@ -10812,7 +10812,7 @@ int ObjectMoleculeGetBondPaths(ObjectMolecule * I, int atom, int max, ObjectMoleculeBPRec * bp) { /* returns list of bond counts from atom to all others - dist and list must be vla array pointers or NULL */ + dist and list must be vla array pointers or nullptr */ int b_cnt = 0; @@ -10860,7 +10860,7 @@ int ***ObjectMoleculeGetBondPrint(ObjectMolecule * I, int max_bond, int max_type { int a, b, i, c; int at1, at2; - int ***result = NULL; + int ***result = nullptr; ObjectMoleculeBPRec bp; dim[0] = max_type + 1; @@ -10964,14 +10964,14 @@ int ObjectMoleculeGetAtomVertex(const ObjectMolecule * I, int state, int index, { int result = 0; if(state < 0) - state = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_state) - 1; + state = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_state) - 1; if(state < 0) state = SceneGetState(I->G); if(I->NCSet == 1) state = 0; /* static singletons always active here it seems */ state = state % I->NCSet; if((!I->CSet[state]) - && (SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_all_states))) + && (SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_all_states))) state = 0; if(I->CSet[state]) result = CoordSetGetAtomVertex(I->CSet[state], index, v); @@ -10989,7 +10989,7 @@ int ObjectMoleculeGetAtomTxfVertex(const ObjectMolecule * I, int state, int inde cs = I->DiscreteCSet[index]; } if(state < 0){ - state = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_state) - 1; + state = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_state) - 1; } if(state < 0) state = SceneGetState(I->G); @@ -10999,7 +10999,7 @@ int ObjectMoleculeGetAtomTxfVertex(const ObjectMolecule * I, int state, int inde { if (!cs) cs = I->CSet[state]; - if((!cs) && (SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_all_states))) { + if((!cs) && (SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_all_states))) { state = 0; cs = I->CSet[state]; } @@ -11015,14 +11015,14 @@ int ObjectMoleculeSetAtomVertex(ObjectMolecule * I, int state, int index, float { int result = 0; if(state < 0) - state = SettingGet_i(I->G, NULL, I->Setting.get(), cSetting_state) - 1; + state = SettingGet_i(I->G, nullptr, I->Setting.get(), cSetting_state) - 1; if(state < 0) state = SceneGetState(I->G); if(I->NCSet == 1) state = 0; state = state % I->NCSet; if((!I->CSet[state]) - && (SettingGet_b(I->G, I->Setting.get(), NULL, cSetting_all_states))) + && (SettingGet_b(I->G, I->Setting.get(), nullptr, cSetting_all_states))) state = 0; if(I->CSet[state]) result = CoordSetSetAtomVertex(I->CSet[state], index, v); @@ -11038,7 +11038,7 @@ void ObjectMolecule::render(RenderInfo * info) const RenderPass pass = info->pass; CoordSet *cs; int pop_matrix = false; - int use_matrices = SettingGet_i(I->G, I->Setting.get(), NULL, cSetting_matrix_mode); + int use_matrices = SettingGet_i(I->G, I->Setting.get(), nullptr, cSetting_matrix_mode); if(use_matrices<0) use_matrices = 0; PRINTFD(I->G, FB_ObjectMolecule) " ObjectMolecule: rendering %s pass %d...\n", I->Name, static_cast(pass) ENDFD; @@ -11105,12 +11105,12 @@ ObjectMolecule::ObjectMolecule(PyMOLGlobals * G, int discreteFlag) : pymol::CObj I->DiscreteAtmToIdx = pymol::vla(0); I->DiscreteCSet = pymol::vla(0); } else { - I->DiscreteAtmToIdx = NULL; - I->DiscreteCSet = NULL; + I->DiscreteAtmToIdx = nullptr; + I->DiscreteCSet = nullptr; } I->AtomInfo = pymol::vla(10); for(a = 0; a <= cUndoMask; a++) { - I->UndoCoord[a] = NULL; + I->UndoCoord[a] = nullptr; I->UndoState[a] = -1; } I->UndoIter = 0; @@ -11126,14 +11126,14 @@ void ObjectMoleculeCopyNoAlloc(const ObjectMolecule* obj, ObjectMolecule* I) BondType *i0; const BondType *i1; (*I) = (*obj); - I->Sculpt = NULL; + I->Sculpt = nullptr; I->Setting.reset(SettingCopyAll(G, obj->Setting.get(), nullptr)); - I->ViewElem = NULL; - I->gridSlotSelIndicatorsCGO = NULL; + I->ViewElem = nullptr; + I->gridSlotSelIndicatorsCGO = nullptr; for(a = 0; a <= cUndoMask; a++) - I->UndoCoord[a] = NULL; + I->UndoCoord[a] = nullptr; I->CSet = pymol::vla(I->NCSet); /* auto-zero */ for(a = 0; a < I->NCSet; a++) { I->CSet[a] = CoordSetCopy(obj->CSet[a]); @@ -11217,7 +11217,7 @@ ObjectMolecule::~ObjectMolecule() for(a = 0; a < I->NCSet; a++){ if(I->CSet[a]) { delete I->CSet[a]; - I->CSet[a] = NULL; + I->CSet[a] = nullptr; } } VLAFreeP(I->DiscreteAtmToIdx); @@ -11259,12 +11259,12 @@ ObjectMolecule *ObjectMoleculeReadPDBStr(PyMOLGlobals * G, ObjectMolecule * I, const char **next_pdb, PDBInfoRec * pdb_info, int quiet, int *model_number) { - CoordSet *cset = NULL; + CoordSet *cset = nullptr; pymol::vla atInfo; int ok = true; int isNew = true; unsigned int nAtom = 0; - const char *start, *restart = NULL; + const char *start, *restart = nullptr; int repeatFlag = true; int successCnt = 0; unsigned int aic_mask = cAIC_PDBMask; @@ -11379,7 +11379,7 @@ ObjectMolecule *ObjectMoleculeReadPDBStr(PyMOLGlobals * G, ObjectMolecule * I, ObjectMoleculeAutoDisableAtomNameWildcard(I); } if(SettingGetGlobal_b(G, cSetting_pdb_hetatm_guess_valences)) { - ObjectMoleculeGuessValences(I, state, NULL, NULL, false); + ObjectMoleculeGuessValences(I, state, nullptr, nullptr, false); } successCnt++; @@ -11415,14 +11415,14 @@ CoordSet *ObjectMoleculeMMDStr2CoordSet(PyMOLGlobals * G, const char *buffer, const char *p; int nAtom, nBond; int a, c, bPart, bOrder; - float *coord = NULL; - CoordSet *cset = NULL; - AtomInfoType *atInfo = NULL, *ai; + float *coord = nullptr; + CoordSet *cset = nullptr; + AtomInfoType *atInfo = nullptr, *ai; char cc[MAXLINELEN]; WordType title; float *f; - BondType *ii, *bond = NULL; + BondType *ii, *bond = nullptr; int ok = true; int auto_show = RepGetAutoShowMask(G); @@ -11602,7 +11602,7 @@ CoordSet *ObjectMoleculeMMDStr2CoordSet(PyMOLGlobals * G, const char *buffer, } if(atInfoPtr) *atInfoPtr = atInfo; - *restart = *p ? p : NULL; + *restart = *p ? p : nullptr; return (cset); } @@ -11660,9 +11660,9 @@ int *AtomInfoGetSortedIndex(PyMOLGlobals * G, setting = obj->Setting.get(); UtilSortIndexGlobals(G, n, rec, index, (UtilOrderFnGlobals *) ( - SettingGet_b(G, setting, NULL, cSetting_retain_order) ? + SettingGet_b(G, setting, nullptr, cSetting_retain_order) ? AtomInfoInOrigOrder : - SettingGet_b(G, setting, NULL, cSetting_pdb_hetatm_sort) ? + SettingGet_b(G, setting, nullptr, cSetting_pdb_hetatm_sort) ? AtomInfoInOrder : AtomInfoInOrderIgnoreHet)); } @@ -11674,7 +11674,7 @@ int *AtomInfoGetSortedIndex(PyMOLGlobals * G, ok_except1: FreeP(index); - return NULL; + return nullptr; } /** @@ -11695,7 +11695,7 @@ bool ObjectMolecule::setNDiscrete(int natom) { for (int i = n; i < natom; ++i) { DiscreteAtmToIdx[i] = -1; - DiscreteCSet[i] = NULL; + DiscreteCSet[i] = nullptr; } return true; diff --git a/layer2/ObjectMolecule2.cpp b/layer2/ObjectMolecule2.cpp index 857876a92..db53946e4 100644 --- a/layer2/ObjectMolecule2.cpp +++ b/layer2/ObjectMolecule2.cpp @@ -97,7 +97,7 @@ static void AddOrthoOutputIfMatchesTags(PyMOLGlobals * G, int n_tags, continue; ParseNTrimRight(cc, p, MAXLINELEN - 1); OrthoAddOutput(G, cc); - OrthoNewLine(G, NULL, true); + OrthoNewLine(G, nullptr, true); break; } } @@ -329,7 +329,7 @@ int ObjectMoleculeAddPseudoatom(ObjectMolecule * I, int sele_index, const char * ai->color = color; } AtomInfoAssignParameters(I->G, ai); - AtomInfoUniquefyNames(I->G, I->AtomInfo, I->NAtom, ai, NULL, 1); + AtomInfoUniquefyNames(I->G, I->AtomInfo, I->NAtom, ai, nullptr, 1); if(!quiet) { PRINTFB(G, FB_ObjectMolecule, FB_Actions) " ObjMol: created %s/%s/%s/%s`%d%c/%s\n", @@ -390,7 +390,7 @@ int ObjectMoleculeAddPseudoatom(ObjectMolecule * I, int sele_index, const char * ai->vdw = vdw; /* NOTE: only uses vdw from first state selection... */ } } else { - pos = NULL; /* skip this state */ + pos = nullptr; /* skip this state */ } } else if(!pos) { SceneGetCenter(I->G, pos_array); @@ -446,7 +446,7 @@ int *ObjectMoleculeGetPrioritizedOtherIndexList(ObjectMolecule * I, CoordSet * c int b1, b2, a1, a2, a3; OtherRec *o; OtherRec *other = pymol::calloc(cs->NIndex); - int *result = NULL; + int *result = nullptr; int offset; int n_alloc = 0; const BondType *bd; @@ -1448,7 +1448,7 @@ int ObjectMoleculeConvertIDsToIndices(ObjectMolecule * I, int *id, int n_id) { /* return true if all IDs are unique, false if otherwise */ - int min_id, max_id, range, *lookup = NULL; + int min_id, max_id, range, *lookup = nullptr; int unique = true; /* this routine only works if IDs cover a reasonable range -- @@ -1529,7 +1529,7 @@ static const char *check_next_pdb_object(const char *p, int skip_to_next) } p = nextline(p); } - return NULL; + return nullptr; } static int get_multi_object_status(const char *p) @@ -1563,11 +1563,11 @@ int ObjectMoleculeAutoDisableAtomNameWildcard(ObjectMolecule * I) int found_wildcard = false; { - const char *tmp = SettingGet_s(G, NULL, I->Setting.get(), cSetting_atom_name_wildcard); + const char *tmp = SettingGet_s(G, nullptr, I->Setting.get(), cSetting_atom_name_wildcard); if(tmp && tmp[0]) { wildcard = *tmp; } else { - tmp = SettingGet_s(G, NULL, I->Setting.get(), cSetting_wildcard); + tmp = SettingGet_s(G, nullptr, I->Setting.get(), cSetting_wildcard); if(tmp) { wildcard = *tmp; } @@ -1611,7 +1611,7 @@ static void ObjectMoleculePDBStr2CoordSetPASS1(PyMOLGlobals * G, int *ok, int *ssFlag, const char **next_pdb, PDBInfoRec *info, int only_read_one_model, int *ignore_conect, int *bondFlag, int *have_bond_order) { int seen_end_of_atoms = false; - *restart_model = NULL; + *restart_model = nullptr; while(*ok && *p) { AddOrthoOutputIfMatchesTags(G, n_tags, *nAtom, tag_start, p, cc, quiet); if((strstartswith(p, "ATOM ") || @@ -1700,7 +1700,7 @@ static SSHash * sshash_new() { return hash; ok_except1: sshash_free(hash); - return NULL; + return nullptr; } /** @@ -1728,14 +1728,14 @@ static int sshash_register_rec(SSHash * hash, ok_assert(1, hash->ss[chain] = pymol::calloc(cResvMask + 1)); } - sst = NULL; + sst = nullptr; // iterate over all residues indicated for(b = ss_resv1; b <= ss_resv2; b++) { index = b & cResvMask; if(hash->ss[chain][index]) { // make a unique copy in the event of multiple entries for one resv - sst = NULL; + sst = nullptr; } if(!sst) { @@ -1755,7 +1755,7 @@ static int sshash_register_rec(SSHash * hash, sst->next = hash->ss[chain][index]; hash->ss[chain][index] = ssi; if(sst->next) - sst = NULL; /* force another unique copy */ + sst = nullptr; /* force another unique copy */ } } return ss_found; @@ -1768,7 +1768,7 @@ static int sshash_register_rec(SSHash * hash, */ static void sshash_lookup(SSHash *hash, AtomInfoType *ai, unsigned char ss_chain1) { int index, ssi; - SSEntry *sst = NULL; + SSEntry *sst = nullptr; index = ai->resv & cResvMask; if(hash->ss[ss_chain1]) { @@ -1874,14 +1874,14 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, const char *p; int nAtom; int a; - float *coord = NULL; - CoordSet *cset = NULL; - AtomInfoType *atInfo = NULL, *ai; + float *coord = nullptr; + CoordSet *cset = nullptr; + AtomInfoType *atInfo = nullptr, *ai; int AFlag; char SSCode; int atomCount; int bondFlag = false; - BondType *bond = NULL, *ii1, *ii2; + BondType *bond = nullptr, *ii1, *ii2; int *idx; int nBond = 0; int b1, b2, nReal, maxAt; @@ -1896,7 +1896,7 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, int ss_resv1 = 0, ss_resv2 = 0; char ss_inscode1 = '\0', ss_inscode2 = '\0'; unsigned char ss_chain1 = 0, ss_chain2 = 0; - SSHash *ss_hash = NULL; + SSHash *ss_hash = nullptr; char cc[MAXLINELEN], tags[MAXLINELEN]; int ignore_pdb_segi = 0; int ss_valid, ss_found = false; @@ -1975,7 +1975,7 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, END PASS 1 */ - *restart_model = NULL; + *restart_model = nullptr; if (ok){ coord = VLAlloc(float, 3 * nAtom); CHECKOK(ok, coord); @@ -2120,7 +2120,7 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, if(info && (info->multiplex == 0)) { /* multiplex == 0: FORCED multimodel behavior with concatenated PDB files */ (*restart_model) = (*next_pdb); - (*next_pdb) = NULL; + (*next_pdb) = nullptr; foundNextModelFlag = true; info->multi_object_status = -1; } else { @@ -2129,14 +2129,14 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, } else if(strstartswith(pp, "MODEL")) { /* not a new object...just a new state (model) */ if(info && (info->multiplex > 0)) { /* end object if we're multiplexing */ (*next_pdb) = check_next_pdb_object(pp, true); - (*restart_model) = NULL; + (*restart_model) = nullptr; } else is_end_of_object = false; } else { if(pp[0] > 32) /* more content follows... */ (*next_pdb) = check_next_pdb_object(pp, true); else - (*next_pdb) = NULL; /* at end of file */ + (*next_pdb) = nullptr; /* at end of file */ } break; } @@ -2154,7 +2154,7 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, if((*next_pdb) && info && (!info->multiplex) && !(*restart_model)) { /* multiplex == 0: FORCED multimodel behavior with concatenated PDB files */ (*restart_model) = (*next_pdb); - (*next_pdb) = NULL; + (*next_pdb) = nullptr; foundNextModelFlag = true; info->multi_object_status = -1; is_end_of_object = false; @@ -2725,14 +2725,14 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, p = nextline(p); } if(!foundNextModelFlag) { - *restart_model = NULL; + *restart_model = nullptr; } } } if (!ok){ if (cset){ delete cset; - cset = NULL; + cset = nullptr; } else { VLAFreeP(coord); VLAFreeP(bond); @@ -2748,9 +2748,9 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, trajectories, then enforce sanity by reading the models first... */ if(is_end_of_object) - (*restart_model) = NULL; + (*restart_model) = nullptr; else if((*next_pdb) < (*restart_model)) - (*next_pdb) = NULL; + (*next_pdb) = nullptr; } } @@ -2763,13 +2763,13 @@ CoordSet *ObjectMoleculePDBStr2CoordSet(PyMOLGlobals * G, void ObjectMoleculeInitHBondCriteria(PyMOLGlobals * G, HBondCriteria * hbc) { - hbc->maxAngle = SettingGet_f(G, NULL, NULL, cSetting_h_bond_max_angle); - hbc->maxDistAtMaxAngle = SettingGet_f(G, NULL, NULL, cSetting_h_bond_cutoff_edge); - hbc->maxDistAtZero = SettingGet_f(G, NULL, NULL, cSetting_h_bond_cutoff_center); - hbc->power_a = SettingGet_f(G, NULL, NULL, cSetting_h_bond_power_a); - hbc->power_b = SettingGet_f(G, NULL, NULL, cSetting_h_bond_power_b); + hbc->maxAngle = SettingGet_f(G, nullptr, nullptr, cSetting_h_bond_max_angle); + hbc->maxDistAtMaxAngle = SettingGet_f(G, nullptr, nullptr, cSetting_h_bond_cutoff_edge); + hbc->maxDistAtZero = SettingGet_f(G, nullptr, nullptr, cSetting_h_bond_cutoff_center); + hbc->power_a = SettingGet_f(G, nullptr, nullptr, cSetting_h_bond_power_a); + hbc->power_b = SettingGet_f(G, nullptr, nullptr, cSetting_h_bond_power_b); hbc->cone_dangle = - (float) cos(PI * 0.5 * SettingGet_f(G, NULL, NULL, cSetting_h_bond_cone) / 180.0F); + (float) cos(PI * 0.5 * SettingGet_f(G, nullptr, nullptr, cSetting_h_bond_cone) / 180.0F); if(hbc->maxDistAtMaxAngle != 0.0F) { hbc->factor_a = (float) (0.5 / pow(hbc->maxAngle, hbc->power_a)); hbc->factor_b = (float) (0.5 / pow(hbc->maxAngle, hbc->power_b)); @@ -2867,7 +2867,7 @@ static int ObjectMoleculeFindBestDonorH(ObjectMolecule * I, best_dot = dot_product3f(best, dir); add3f(orig, best, best); if(h_real) - *h_real = NULL; + *h_real = nullptr; } } /* iterate through real hydrogens looking for best match @@ -2923,7 +2923,7 @@ int ObjectMoleculeGetCheckHBond(AtomInfoType **h_real, float donToH[3]; float bestH[3]; float hToAcc[3]; - float accPlane[3], *vAccPlane = NULL; + float accPlane[3], *vAccPlane = nullptr; /* first, check for existence of coordinate sets */ @@ -2993,7 +2993,7 @@ float ObjectMoleculeGetMaxVDW(ObjectMolecule * I) /*========================================================================*/ static PyObject *ObjectMoleculeCSetAsPyList(ObjectMolecule * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->NCSet); for(a = 0; a < I->NCSet; a++) { @@ -3009,7 +3009,7 @@ static PyObject *ObjectMoleculeCSetAsPyList(ObjectMolecule * I) /*static PyObject *ObjectMoleculeDiscreteCSetAsPyList(ObjectMolecule *I) { - PyObject *result = NULL; + PyObject *result = nullptr; return(PConvAutoNone(result)); }*/ static int ObjectMoleculeCSetFromPyList(ObjectMolecule * I, PyObject * list) @@ -3036,7 +3036,7 @@ static int ObjectMoleculeCSetFromPyList(ObjectMolecule * I, PyObject * list) static PyObject *ObjectMoleculeBondAsPyList(ObjectMolecule * I) { - PyObject *result = NULL; + PyObject *result = nullptr; PyObject *bond_list; const BondType *bond; int a; @@ -3093,7 +3093,7 @@ static int ObjectMoleculeBondFromPyList(ObjectMolecule * I, PyObject * list) int ok = true; int a; int stereo, ll = 0; - PyObject *bond_list = NULL; + PyObject *bond_list = nullptr; BondType *bond; if(ok) @@ -3130,7 +3130,7 @@ static int ObjectMoleculeBondFromPyList(ObjectMolecule * I, PyObject * list) ok = bool((I->Bond = pymol::vla(I->NBond))); bond = I->Bond.data(); for(a = 0; a < I->NBond; a++) { - bond_list = NULL; + bond_list = nullptr; if(ok) bond_list = PyList_GetItem(list, a); if(ok) @@ -3248,7 +3248,7 @@ static void AtomColumnFromPyList(ObjectMolecule& mol, PyObject* list, static PyObject *ObjectMoleculeAtomAsPyList(ObjectMolecule * I) { PyMOLGlobals *G = I->G; - PyObject *result = NULL; + PyObject *result = nullptr; const AtomInfoType *ai; int a; #ifndef PICKLETOOLS @@ -3447,9 +3447,9 @@ int ObjectMoleculeNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectMolecule ** result) { int ok = true; - ObjectMolecule *I = NULL; + ObjectMolecule *I = nullptr; int discrete_flag = 0; - (*result) = NULL; + (*result) = nullptr; if(ok) ok = PyList_Check(list); @@ -3514,7 +3514,7 @@ int ObjectMoleculeNewFromPyList(PyMOLGlobals * G, PyObject * list, /* cleanup */ if (I) DeleteP(I); - (*result) = NULL; + (*result) = nullptr; } return (ok); } @@ -3523,7 +3523,7 @@ int ObjectMoleculeNewFromPyList(PyMOLGlobals * G, PyObject * list, /*========================================================================*/ PyObject *ObjectMoleculeAsPyList(ObjectMolecule * I) { - PyObject *result = NULL; + PyObject *result = nullptr; /* first, dump the atoms */ @@ -4041,7 +4041,7 @@ void ObjectMoleculeConnectDiscrete(ObjectMolecule* I, int searchFlag, int ObjectMoleculeSort(ObjectMolecule * I) { /* sorts atoms and bonds */ int *index; - int *outdex = NULL; + int *outdex = nullptr; int a, b; int ok = true; if(!I->DiscreteFlag) { /* currently, discrete objects are never sorted */ diff --git a/layer2/ObjectSlice.cpp b/layer2/ObjectSlice.cpp index 388cf2351..8a0a66545 100644 --- a/layer2/ObjectSlice.cpp +++ b/layer2/ObjectSlice.cpp @@ -51,7 +51,7 @@ static void ObjectSliceRecomputeExtent(ObjectSlice * I); static PyObject *ObjectSliceStateAsPyList(ObjectSliceState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(10); @@ -72,7 +72,7 @@ static PyObject *ObjectSliceStateAsPyList(ObjectSliceState * I) static PyObject *ObjectSliceAllStatesAsPyList(ObjectSlice * I) { - PyObject *result = NULL; + PyObject *result = nullptr; int a; result = PyList_New(I->State.size()); for(a = 0; a < I->State.size(); a++) { @@ -92,13 +92,13 @@ static int ObjectSliceStateFromPyList(PyMOLGlobals * G, ObjectSliceState * I, int ok = true; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) { if(!PyList_Check(list)) I->Active = false; else { if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... @@ -155,11 +155,11 @@ static int ObjectSliceAllStatesFromPyList(ObjectSlice * I, PyObject * list, int int ObjectSliceNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectSlice ** result) { int ok = true; - ObjectSlice *I = NULL; - (*result) = NULL; + ObjectSlice *I = nullptr; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... @@ -167,7 +167,7 @@ int ObjectSliceNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectSlice ** r I = new ObjectSlice(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ CPythonVal *val = CPythonVal_PyList_GetItem(G, list, 0); @@ -193,7 +193,7 @@ int ObjectSliceNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectSlice ** r PyObject *ObjectSliceAsPyList(ObjectSlice * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(3); PyList_SetItem(result, 0, ObjectAsPyList(I)); @@ -250,12 +250,12 @@ static void ObjectSliceStateUpdate(ObjectSlice * I, ObjectSliceState * oss, int min[2] = { 0, 0 }, max[2] = { 0, 0}; /* limits of the rectangle */ int need_normals = false; - int track_camera = SettingGet_b(I->G, NULL, I->Setting.get(), cSetting_slice_track_camera); - float grid = SettingGet_f(I->G, NULL, I->Setting.get(), cSetting_slice_grid); + int track_camera = SettingGet_b(I->G, nullptr, I->Setting.get(), cSetting_slice_track_camera); + float grid = SettingGet_f(I->G, nullptr, I->Setting.get(), cSetting_slice_grid); int min_expand = 1; - if(SettingGet_b(I->G, NULL, I->Setting.get(), cSetting_slice_dynamic_grid)) { - float resol = SettingGet_f(I->G, NULL, I->Setting.get(), + if(SettingGet_b(I->G, nullptr, I->Setting.get(), cSetting_slice_dynamic_grid)) { + float resol = SettingGet_f(I->G, nullptr, I->Setting.get(), cSetting_slice_dynamic_grid_resolution); float scale = SceneGetScreenVertexScale(I->G, oss->origin); oss->last_scale = scale; @@ -422,9 +422,9 @@ static void ObjectSliceStateUpdate(ObjectSlice * I, ObjectSliceState * oss, if(ok) { - if(SettingGet_b(I->G, NULL, I->Setting.get(), cSetting_slice_height_map)) { + if(SettingGet_b(I->G, nullptr, I->Setting.get(), cSetting_slice_height_map)) { float height_scale = - SettingGet_f(I->G, NULL, I->Setting.get(), cSetting_slice_height_scale); + SettingGet_f(I->G, nullptr, I->Setting.get(), cSetting_slice_height_scale); float *value = oss->values.data(); float up[3], scaled[3], factor; int x, y; @@ -545,7 +545,7 @@ static void ObjectSliceStateUpdate(ObjectSlice * I, ObjectSliceState * oss, if(!need_normals) { VLAFreeP(oss->normals); } else { - int *cnt = NULL; + int *cnt = nullptr; oss->normals.reserve(oss->n_points * 3); cnt = pymol::calloc(oss->n_points); @@ -625,9 +625,9 @@ void ObjectSlice::update() auto I = this; ObjectSliceState *oss; - ObjectMapState *oms = NULL; - ObjectMap *map = NULL; - ObjectGadgetRamp *ogr = NULL; + ObjectMapState *oms = nullptr; + ObjectMap *map = nullptr; + ObjectGadgetRamp *ogr = nullptr; int a; for(a = 0; a < I->State.size(); a++) { @@ -673,7 +673,7 @@ void ObjectSlice::update() void ObjectSliceDrag(ObjectSlice * I, int state, int mode, float *pt, float *mov, float *z_dir) { - ObjectSliceState *oss = NULL; + ObjectSliceState *oss = nullptr; if(state >= 0) if(state < I->State.size()) @@ -744,7 +744,7 @@ int ObjectSliceGetVertex(ObjectSlice * I, int index, int base, float *v) int offset = base - 1; int result = false; - ObjectSliceState *oss = NULL; + ObjectSliceState *oss = nullptr; if(state >= 0) if(state < I->State.size()) @@ -911,10 +911,10 @@ void ObjectSlice::render(RenderInfo * info) const RenderPass pass = info->pass; int cur_state = 0; float alpha; - int track_camera = SettingGet_b(G, NULL, I->Setting.get(), cSetting_slice_track_camera); - int dynamic_grid = SettingGet_b(G, NULL, I->Setting.get(), cSetting_slice_dynamic_grid); - ObjectSliceState *oss = NULL; - int use_shaders = !track_camera && SettingGet_b(G, NULL, I->Setting.get(), cSetting_use_shaders); + int track_camera = SettingGet_b(G, nullptr, I->Setting.get(), cSetting_slice_track_camera); + int dynamic_grid = SettingGet_b(G, nullptr, I->Setting.get(), cSetting_slice_dynamic_grid); + ObjectSliceState *oss = nullptr; + int use_shaders = !track_camera && SettingGet_b(G, nullptr, I->Setting.get(), cSetting_use_shaders); // just in case, since slice uses immediate mode, but this should never happen G->ShaderMgr->Disable_Current_Shader(); @@ -972,7 +972,7 @@ void ObjectSlice::render(RenderInfo * info) } ObjectPrepareContext(I, info); - alpha = SettingGet_f(G, NULL, I->Setting.get(), cSetting_transparency); + alpha = SettingGet_f(G, nullptr, I->Setting.get(), cSetting_transparency); alpha = 1.0F - alpha; if(fabs(alpha - 1.0) < R_SMALL4) alpha = 1.0F; @@ -1067,7 +1067,7 @@ void ObjectSlice::render(RenderInfo * info) } else if(G->HaveGUI && G->ValidContext) { if(pick) { if (oss->shaderCGO && (I->visRep & cRepSliceBit)){ - CGORenderPicking(oss->shaderCGO.get(), info, &I->context, I->Setting.get(), NULL); + CGORenderPicking(oss->shaderCGO.get(), info, &I->context, I->Setting.get(), nullptr); } else { #ifndef PURE_OPENGL_ES_2 Picking p; @@ -1145,7 +1145,7 @@ void ObjectSlice::render(RenderInfo * info) int already_rendered = false; if (oss->shaderCGO){ - CGORender(oss->shaderCGO.get(), NULL, NULL, I->Setting.get(), info, NULL); + CGORender(oss->shaderCGO.get(), nullptr, nullptr, I->Setting.get(), info, nullptr); already_rendered = true; } else { oss->shaderCGO.reset(CGONew(G)); @@ -1211,7 +1211,7 @@ void ObjectSlice::render(RenderInfo * info) oss->shaderCGO.reset(CGOOptimizeToVBONotIndexed(oss->shaderCGO.get())); assert(oss->shaderCGO->use_shader); } - CGORender(oss->shaderCGO.get(), NULL, NULL, I->Setting.get(), info, NULL); + CGORender(oss->shaderCGO.get(), nullptr, nullptr, I->Setting.get(), info, nullptr); SceneInvalidatePicking(G); // any time cgo is re-generated, needs to invalidate so // pick colors can be re-assigned } @@ -1239,12 +1239,12 @@ int ObjectSlice::getNFrame() const ObjectSliceState *ObjectSliceStateGetActive(ObjectSlice * I, int state) { - ObjectSliceState *ms = NULL; + ObjectSliceState *ms = nullptr; if(state >= 0) { if(state < I->State.size()) { ms = &I->State[state]; if(!ms->Active) - ms = NULL; + ms = nullptr; } } return (ms); @@ -1303,7 +1303,7 @@ ObjectSlice *ObjectSliceFromMap(PyMOLGlobals * G, ObjectSlice * obj, ObjectMap * { float tmp[3]; - if(ObjectMapStateGetExcludedStats(G, oms, NULL, 0.0F, 0.0F, tmp)) { + if(ObjectMapStateGetExcludedStats(G, oms, nullptr, 0.0F, 0.0F, tmp)) { oss->MapMean = tmp[1]; oss->MapStdev = tmp[2] - tmp[1]; } else { diff --git a/layer2/ObjectSurface.cpp b/layer2/ObjectSurface.cpp index 5080ba886..169e651cd 100644 --- a/layer2/ObjectSurface.cpp +++ b/layer2/ObjectSurface.cpp @@ -48,7 +48,7 @@ static void ObjectSurfaceRecomputeExtent(ObjectSurface * I); static PyObject *ObjectSurfaceStateAsPyList(ObjectSurfaceState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(17); @@ -99,7 +99,7 @@ static int ObjectSurfaceStateFromPyList(PyMOLGlobals * G, ObjectSurfaceState * I int ll = 0; PyObject *tmp; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) { if(!PyList_Check(list)) I->Active = false; @@ -136,7 +136,7 @@ static int ObjectSurfaceStateFromPyList(PyMOLGlobals * G, ObjectSurfaceState * I if(ok) { tmp = PyList_GetItem(list, 12); if(tmp == Py_None) - I->AtomVertex = NULL; + I->AtomVertex = nullptr; else ok = PConvPyListToFloatVLA(tmp, &I->AtomVertex); } @@ -183,17 +183,17 @@ static int ObjectSurfaceAllStatesFromPyList(ObjectSurface * I, PyObject * list, int ObjectSurfaceNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectSurface ** result) { int ok = true; - ObjectSurface *I = NULL; - (*result) = NULL; + ObjectSurface *I = nullptr; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); I = new ObjectSurface(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ auto *val = PyList_GetItem(list, 0); @@ -218,7 +218,7 @@ int ObjectSurfaceNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectSurface PyObject *ObjectSurfaceAsPyList(ObjectSurface * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(3); PyList_SetItem(result, 0, ObjectAsPyList(I)); @@ -327,7 +327,7 @@ static void ObjectSurfaceStateUpdateColors(ObjectSurface * I, ObjectSurfaceState { int one_color_flag = true; int cur_color = - SettingGet_color(I->G, I->Setting.get(), NULL, cSetting_surface_color); + SettingGet_color(I->G, I->Setting.get(), nullptr, cSetting_surface_color); if(cur_color == -1) cur_color = I->Color; @@ -369,7 +369,7 @@ static void ObjectSurfaceStateUpdateColors(ObjectSurface * I, ObjectSurfaceState for(a = 0; a < n_vert; a++) { if(a == base_n_vert) { int new_color = SettingGet_color(I->G, I->Setting.get(), - NULL, cSetting_surface_negative_color); + nullptr, cSetting_surface_negative_color); if(new_color == -1) new_color = cur_color; if(new_color != cur_color) { @@ -413,7 +413,7 @@ static void ObjectSurfaceStateUpdateColors(ObjectSurface * I, ObjectSurfaceState for(a = 0; a < n_vert; a++) { if(a == base_n_vert) { int new_color = SettingGet_color(I->G, I->Setting.get(), - NULL, cSetting_surface_negative_color); + nullptr, cSetting_surface_negative_color); if(new_color == -1) new_color = cur_color; if(new_color != cur_color) @@ -443,7 +443,7 @@ static void ObjectSurfaceStateUpdateColors(ObjectSurface * I, ObjectSurfaceState ms->RC.clear(); } else if((!ramped_flag) || - (!SettingGet_b(I->G, NULL, I->Setting.get(), cSetting_ray_color_ramps))) { + (!SettingGet_b(I->G, nullptr, I->Setting.get(), cSetting_ray_color_ramps))) { ms->RC.clear(); } } @@ -454,8 +454,8 @@ void ObjectSurface::update() auto I = this; for(auto& msref : I->State) { ObjectSurfaceState *ms = &msref; - ObjectMapState *oms = NULL; - ObjectMap *map = NULL; + ObjectMapState *oms = nullptr; + ObjectMap *map = nullptr; if(ms->Active) { map = ExecutiveFindObjectMapByName(I->G, ms->MapName); @@ -530,7 +530,7 @@ void ObjectSurface::update() ms->Side); if(!SettingGet_b - (I->G, I->Setting.get(), NULL, cSetting_surface_negative_visible)) { + (I->G, I->Setting.get(), nullptr, cSetting_surface_negative_visible)) { ms->base_n_V = VLAGetSize(ms->V); } else { /* do we want the negative surface too? */ @@ -762,7 +762,7 @@ static void ObjectSurfaceRenderRay(PyMOLGlobals * G, ObjectSurface *I, float *v = ms->V.data(); int c; int* n = ms->N.data(); - float alpha = 1.0F - SettingGet_f(G, NULL, I->Setting.get(), cSetting_transparency); + float alpha = 1.0F - SettingGet_f(G, nullptr, I->Setting.get(), cSetting_transparency); if(fabs(alpha - 1.0) < R_SMALL4) alpha = 1.0F; @@ -770,17 +770,17 @@ static void ObjectSurfaceRenderRay(PyMOLGlobals * G, ObjectSurface *I, CRay *ray = info->ray; if(ms->UnitCellCGO && (I->visRep & cRepCellBit)){ int rayok = CGORenderRay(ms->UnitCellCGO.get(), ray, info, ColorGet(G, I->Color), - NULL, I->Setting.get(), NULL); + nullptr, I->Setting.get(), nullptr); if (!rayok){ ms->UnitCellCGO.reset(); } } ray->transparentf(1.0F - alpha); - ms->Radius = SettingGet_f(G, I->Setting.get(), NULL, cSetting_mesh_radius); + ms->Radius = SettingGet_f(G, I->Setting.get(), nullptr, cSetting_mesh_radius); if(ms->Radius == 0.0F) { ms->Radius = ray->PixelRadius * - SettingGet_f(I->G, I->Setting.get(), NULL, cSetting_mesh_width) / 2.0F; + SettingGet_f(I->G, I->Setting.get(), nullptr, cSetting_mesh_width) / 2.0F; } if(n && v && (I->visRep & cRepSurfaceBit)) { @@ -900,11 +900,11 @@ void ObjectSurface::render(RenderInfo * info) auto pick = info->pick; const RenderPass pass = info->pass; const float *col; - ObjectSurfaceState *ms = NULL; + ObjectSurfaceState *ms = nullptr; float alpha; ObjectPrepareContext(I, info); - alpha = 1.0F - SettingGet_f(G, NULL, I->Setting.get(), cSetting_transparency); + alpha = 1.0F - SettingGet_f(G, nullptr, I->Setting.get(), cSetting_transparency); if(fabs(alpha - 1.0) < R_SMALL4) alpha = 1.0F; @@ -940,7 +940,7 @@ void ObjectSurface::render(RenderInfo * info) } if (ms->shaderCGO){ - CGORender(ms->shaderCGO.get(), NULL, NULL, NULL, info, NULL); + CGORender(ms->shaderCGO.get(), nullptr, nullptr, nullptr, info, nullptr); continue; } @@ -977,7 +977,7 @@ void ObjectSurface::render(RenderInfo * info) ms->shaderCGO.reset(convertcgo); } ms->shaderCGO->use_shader = true; - CGORender(ms->shaderCGO.get(), NULL, NULL, NULL, info, NULL); + CGORender(ms->shaderCGO.get(), nullptr, nullptr, nullptr, info, nullptr); } else { if (alpha != 1.0){ // use_shader = 0 @@ -986,7 +986,7 @@ void ObjectSurface::render(RenderInfo * info) ms->shaderCGO->render_alpha = 1; } ms->shaderCGO->use_shader = false; - CGORender(ms->shaderCGO.get(), NULL, NULL, NULL, info, NULL); + CGORender(ms->shaderCGO.get(), nullptr, nullptr, nullptr, info, nullptr); } } } diff --git a/layer2/ObjectVolume.cpp b/layer2/ObjectVolume.cpp index 8a88ffa78..cd7b30240 100644 --- a/layer2/ObjectVolume.cpp +++ b/layer2/ObjectVolume.cpp @@ -70,7 +70,7 @@ CObjectState* ObjectVolume::_getObjectState(int state) } static ObjectMapState * ObjectVolumeStateGetMapState(ObjectVolumeState * vs) { - ObjectMap *map = NULL; + ObjectMap *map = nullptr; PyMOLGlobals * G = vs->G; @@ -79,7 +79,7 @@ static ObjectMapState * ObjectVolumeStateGetMapState(ObjectVolumeState * vs) { PRINTFB(G, FB_ObjectVolume, FB_Errors) "ObjectVolume-Error: map '%s' has been deleted.\n", vs->MapName ENDFB(G); - return NULL; + return nullptr; } return ObjectMapGetState(map, vs->MapState); @@ -89,12 +89,12 @@ ObjectMapState * ObjectVolumeGetMapState(ObjectVolume * I) { ObjectVolumeState * ovs = ObjectVolumeGetActiveState(I); if(ovs) return ObjectVolumeStateGetMapState(ovs); - return NULL; + return nullptr; } static PyObject *ObjectVolumeStateAsPyList(ObjectVolumeState * I) { - PyObject *result = NULL; + PyObject *result = nullptr; result = PyList_New(19); PyList_SetItem(result, 0, PyInt_FromLong(I->Active)); PyList_SetItem(result, 1, PyString_FromString(I->MapName)); @@ -106,7 +106,7 @@ static PyObject *ObjectVolumeStateAsPyList(ObjectVolumeState * I) PyList_SetItem(result, 7, PConvAutoNone(NULL) /* PConvIntArrayToPyList(I->Range, 6) */); PyList_SetItem(result, 8, PyFloat_FromDouble(0.0 /* I->Level */)); PyList_SetItem(result, 9, PyFloat_FromDouble(0.0 /* I->Radius */)); - PyList_SetItem(result, 10, PyInt_FromLong(/* I->CarveFlag */ I->AtomVertex.data() != NULL)); + PyList_SetItem(result, 10, PyInt_FromLong(/* I->CarveFlag */ I->AtomVertex.data() != nullptr)); PyList_SetItem(result, 11, PyFloat_FromDouble(I->CarveBuffer)); PyList_SetItem(result, 12, I->AtomVertex ? PConvFloatVLAToPyList(I->AtomVertex) : PConvAutoNone(NULL)); @@ -147,14 +147,14 @@ static int ObjectVolumeStateFromPyList(PyMOLGlobals * G, ObjectVolumeState * I, int ll = 0; PyObject *tmp; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) { if(!PyList_Check(list)) I->Active = false; else { *I = ObjectVolumeState(G); if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -192,7 +192,7 @@ static int ObjectVolumeStateFromPyList(PyMOLGlobals * G, ObjectVolumeState * I, if(ok) { tmp = PyList_GetItem(list, 12); if(tmp == Py_None) - I->AtomVertex = NULL; + I->AtomVertex = nullptr; else ok = PConvPyListToFloatVLA(tmp, &I->AtomVertex); } @@ -265,17 +265,17 @@ static int ObjectVolumeAllStatesFromPyList(ObjectVolume * I, PyObject * list) int ObjectVolumeNewFromPyList(PyMOLGlobals * G, PyObject * list, ObjectVolume ** result) { int ok = true; - ObjectVolume *I = NULL; - (*result) = NULL; + ObjectVolume *I = nullptr; + (*result) = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); /* TO SUPPORT BACKWARDS COMPATIBILITY... Always check ll when adding new PyList_GetItem's */ I = new ObjectVolume(G); if(ok) - ok = (I != NULL); + ok = (I != nullptr); if(ok){ auto *val = PyList_GetItem(list, 0); ok = ObjectFromPyList(G, val, I); @@ -369,7 +369,7 @@ void ObjectVolume::invalidate(cRep_t rep, cRepInv_t level, int state) */ static CField * ObjectVolumeStateGetField(ObjectVolumeState * vs) { if (!vs) - return NULL; + return nullptr; if(vs->Field) return vs->Field->data.get(); return ObjectVolumeStateGetMapState(vs)->Field->data.get(); @@ -396,7 +396,7 @@ static void get44FracToRealFromCorner(const float * corner, float * frac2real) void ObjectVolume::update() { auto I = this; - ObjectMapState *oms = NULL; + ObjectMapState *oms = nullptr; float carve_buffer; int avoid_flag = false; int flag; @@ -429,7 +429,7 @@ void ObjectVolume::update() } // data min/max/mean/stdev - range = SettingGet_f(I->G, I->Setting.get(), NULL, cSetting_volume_data_range); + range = SettingGet_f(I->G, I->Setting.get(), nullptr, cSetting_volume_data_range); ObjectMapStateGetHistogram(I->G, oms, 0, range, vs->min_max_mean_stdev, 0.f, 0.f); } @@ -463,14 +463,14 @@ void ObjectVolume::update() } if((I->visRep & cRepVolumeBit) && vs->ResurfaceFlag) { - Isofield *field = NULL; + Isofield *field = nullptr; vs->ResurfaceFlag = false; if(vs->Field) { field = vs->Field.get(); } else if(oms->Field) { field = oms->Field.get(); } else { - field = NULL; + field = nullptr; } if(field) { @@ -498,7 +498,7 @@ void ObjectVolume::update() // cull my friend, cull */ voxelmap = MapNew(I->G, -carve_buffer, vs->AtomVertex, - vs->AtomVertex.size() / 3, NULL); + vs->AtomVertex.size() / 3, nullptr); if(voxelmap) { int x, y, z; @@ -611,7 +611,7 @@ static float * ObjectVolumeStateGetColors(PyMOLGlobals * G, ObjectVolumeState * ok_except1: PRINTFB(G, FB_ObjectVolume, FB_Blather) "ObjectVolumeStateGetColors failed\n" ENDFB(G); - return NULL; + return nullptr; } /** @@ -725,8 +725,8 @@ void ObjectVolume::render(RenderInfo * info) int state = info->state; const RenderPass pass = info->pass; int a = 0; - ObjectVolumeState *vs = NULL; - float volume_layers = SettingGet_f(I->G, I->Setting.get(), NULL, cSetting_volume_layers); + ObjectVolumeState *vs = nullptr; + float volume_layers = SettingGet_f(I->G, I->Setting.get(), nullptr, cSetting_volume_layers); #ifdef _PYMOL_IP_EXTRAS short volume_mode = SettingGetGlobal_i(G, cSetting_volume_mode); short ortho = SettingGetGlobal_i(G, cSetting_ortho); @@ -833,7 +833,7 @@ void ObjectVolume::render(RenderInfo * info) return; } - int volume_bit_val = SettingGet_i(G, I->Setting.get(), NULL, cSetting_volume_bit_depth); + int volume_bit_val = SettingGet_i(G, I->Setting.get(), nullptr, cSetting_volume_bit_depth); volume_bit_depth = (volume_bit_val < 17) ? tex::data_type::HALF_FLOAT : tex::data_type::FLOAT; /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ @@ -1224,7 +1224,7 @@ ObjectVolume *ObjectVolumeFromBox(PyMOLGlobals * G, ObjectVolume * obj, ObjectMa float level, int meshMode, float carve, float *vert_vla, int quiet) { - return ObjectVolumeFromXtalSym(G, obj, map, NULL, map_state, state, mn, mx, + return ObjectVolumeFromXtalSym(G, obj, map, nullptr, map_state, state, mn, mx, level, meshMode, carve, vert_vla, quiet); } diff --git a/layer2/RepAngle.cpp b/layer2/RepAngle.cpp index 99250dedc..b30e7a9f1 100644 --- a/layer2/RepAngle.cpp +++ b/layer2/RepAngle.cpp @@ -61,14 +61,14 @@ static int RepAngleCGOGenerate(RepAngle * I, RenderInfo * info) PyMOLGlobals *G = I->G; float line_width; int ok = true; - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; int dash_as_cylinders = SettingGetGlobal_b(G, cSetting_render_as_cylinders) && SettingGetGlobal_b(G, cSetting_dash_as_cylinders); int color = - SettingGet_color(G, NULL, I->ds->Obj->Setting.get(), cSetting_angle_color); + SettingGet_color(G, nullptr, I->ds->Obj->Setting.get(), cSetting_angle_color); I->linewidth = line_width = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_width); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_width); I->radius = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_radius); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_radius); line_width = SceneGetDynamicLineWidth(info, line_width); ok &= CGOSpecial(I->shaderCGO, LINEWIDTH_DYNAMIC_WITH_SCALE_DASH); if (ok) @@ -115,7 +115,7 @@ static int RepAngleCGOGenerate(RepAngle * I, RenderInfo * info) CHECKOK(ok, convertcgo); CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; if (ok){ if (dash_as_cylinders){ CGO *tmpCGO = CGONew(G); @@ -148,7 +148,7 @@ static int RepAngleCGOGenerate(RepAngle * I, RenderInfo * info) if (convertcgo){ CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; } return ok; } @@ -162,9 +162,9 @@ static void RepAngleRenderImmediate(RepAngle * I, RenderInfo * info, int color, int c = I->N; float line_width; bool t_mode_3 = - SettingGet_i(G, NULL, I->ds->Obj->Setting.get(), cSetting_transparency_mode) == 3; + SettingGet_i(G, nullptr, I->ds->Obj->Setting.get(), cSetting_transparency_mode) == 3; line_width = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_width); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_width); line_width = SceneGetDynamicLineWidth(info, line_width); if(info->width_scale_flag) { @@ -213,18 +213,18 @@ void RepAngle::render(RenderInfo* info) float dash_transparency; short dash_transparency_enabled; int color = - SettingGet_color(G, NULL, I->ds->Obj->Setting.get(), cSetting_angle_color); + SettingGet_color(G, nullptr, I->ds->Obj->Setting.get(), cSetting_angle_color); if(color < 0) color = getObj()->Color; I->linewidth = line_width = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_width); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_width); I->radius = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_radius); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_radius); round_ends = - SettingGet_b(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_round_ends); + SettingGet_b(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_round_ends); line_width = SceneGetDynamicLineWidth(info, line_width); dash_transparency = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_transparency); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_transparency); dash_transparency = (dash_transparency < 0.f ? 0.f : (dash_transparency > 1.f ? 1.f : dash_transparency)); dash_transparency_enabled = (dash_transparency > 0.f); @@ -283,7 +283,7 @@ void RepAngle::render(RenderInfo* info) } ok &= RepAngleCGOGenerate(I, info); } else { - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); return; } } @@ -291,13 +291,13 @@ void RepAngle::render(RenderInfo* info) if (!generate_shader_cgo) { RepAngleRenderImmediate(I, info, color, dash_transparency_enabled, dash_transparency); } else { - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); } } } if (!ok){ CGOFree(I->shaderCGO); - I->ds->Rep[cRepAngle] = NULL; + I->ds->Rep[cRepAngle] = nullptr; delete I; } } @@ -313,7 +313,7 @@ Rep *RepAngleNew(DistSet * ds, int state) int ok = true; float dash_transparency; dash_transparency = - SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dash_transparency); + SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dash_transparency); dash_transparency = (dash_transparency < 0.f ? 0.f : (dash_transparency > 1.f ? 1.f : dash_transparency)); PRINTFD(G, FB_RepAngle) @@ -324,8 +324,8 @@ Rep *RepAngleNew(DistSet * ds, int state) auto I = new RepAngle(ds->Obj, state); - dash_len = SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dash_length); - dash_gap = SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dash_gap); + dash_len = SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dash_length); + dash_gap = SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dash_gap); dash_sum = dash_len + dash_gap; if(dash_sum < R_SMALL4) dash_sum = 0.1F; @@ -351,7 +351,7 @@ Rep *RepAngleNew(DistSet * ds, int state) radius = l2; else radius = l1; - radius *= SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_angle_size); + radius *= SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_angle_size); angle = get_angle3f(d1, d2); @@ -455,7 +455,7 @@ Rep *RepAngleNew(DistSet * ds, int state) } if (!ok){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/RepCartoon.cpp b/layer2/RepCartoon.cpp index 813d3af3c..2467f0105 100644 --- a/layer2/RepCartoon.cpp +++ b/layer2/RepCartoon.cpp @@ -74,7 +74,7 @@ struct RepCartoon : Rep { /** * Free the preshader CGO or move to another owner. - * @post preshader == NULL + * @post preshader == nullptr */ void disposePreshaderCGO() { if (!ray) { @@ -276,7 +276,7 @@ void RepCartoon::render(RenderInfo* info) CGORenderPicking(I->std, info, &I->context, I->cs->Setting.get(), I->obj->Setting.get()); } else { - CGORender(I->std, NULL, I->cs->Setting.get(), I->obj->Setting.get(), info, I); + CGORender(I->std, nullptr, I->cs->Setting.get(), I->obj->Setting.get(), info, I); } } } @@ -300,7 +300,7 @@ typedef struct nuc_acid_data { int *nuc_flag; // whether atom is part of nucleotide int a2; // defaults to -1 int nSeg; // defaults to 0 - const float *v_o_last; // defaults to NULL + const float *v_o_last; // defaults to nullptr int *sptr; int *iptr; CCInOut * cc; @@ -1145,7 +1145,7 @@ static void do_ring(PyMOLGlobals * G, nuc_acid_data *ndata, int n_atom, int i; float up[3], upi[3]; float vc0[3], vc1[3]; - const float *color = NULL; + const float *color = nullptr; /* compute average coordinate and mark atoms so that ring is only drawn once */ zero3f(avg); zero3f(avg_col); @@ -1382,7 +1382,7 @@ static void nuc_acid(PyMOLGlobals * G, nuc_acid_data *ndata, int a, int a1, if(ndata->a2 < 0) { ndata->nSeg++; - ndata->v_o_last = NULL; + ndata->v_o_last = nullptr; } *(ndata->sptr++) = ndata->nSeg; *(ndata->iptr++) = a; @@ -1402,7 +1402,7 @@ static void nuc_acid(PyMOLGlobals * G, nuc_acid_data *ndata, int a, int a1, if(ndata->a2 >= 0) { if(set_flags) { if((obj->AtomInfo[ndata->a2].protons == cAN_P) && (!nuc_flag[ndata->a2])) { - int *nf = NULL; + int *nf = nullptr; AtomInfoBracketResidueFast(G, obj->AtomInfo, obj->NAtom, ndata->a2, &st, &nd); nf = nuc_flag + st; @@ -1421,13 +1421,13 @@ static void nuc_acid(PyMOLGlobals * G, nuc_acid_data *ndata, int a, int a1, ndata->ss++; - v_c = NULL; - v_o = NULL; + v_c = nullptr; + v_o = nullptr; AtomInfoBracketResidueFast(G, obj->AtomInfo, obj->NAtom, a1, &st, &nd); { - int *nf = NULL; + int *nf = nullptr; if(set_flags && ndata->v_o_last) nf = nuc_flag + st; for(a3 = st; a3 <= nd; a3++) { @@ -1451,7 +1451,7 @@ static void nuc_acid(PyMOLGlobals * G, nuc_acid_data *ndata, int a, int a1, } if(!(v_c && v_o)) { zero3f(ndata->voptr); - ndata->v_o_last = NULL; + ndata->v_o_last = nullptr; } else { if(ndata->v_o_last) { float t0[3]; @@ -1479,10 +1479,10 @@ void GenerateRepCartoonDrawDebugLineAlongPath(CGO *cgo, int nAt, float *pv){ #ifndef PURE_OPENGL_ES_2 CGODisable(cgo, GL_LIGHTING); #endif - v1 = NULL; - v2 = NULL; - v3 = NULL; - v4 = NULL; + v1 = nullptr; + v2 = nullptr; + v3 = nullptr; + v4 = nullptr; v = pv; if(nAt > 1) { CGOBegin(cgo, GL_LINE_STRIP); @@ -1590,7 +1590,7 @@ int GenerateRepCartoonProcessCylindricalHelices(PyMOLGlobals * G, ObjectMolecule const float *v0; float *v, *v1, *v2, *vo, *d; float *valpha; - float *vc = NULL; + float *vc = nullptr; int atom_index1, atom_index2, *s, *atp, a, cur_car; unsigned *vi; @@ -1598,7 +1598,7 @@ int GenerateRepCartoonProcessCylindricalHelices(PyMOLGlobals * G, ObjectMolecule bool hasAtomLevelTrans = false; int contFlag, extrudeFlag; int b, c1, c2; - float *h_start = NULL, *h_end = NULL; + float *h_start = nullptr, *h_end = nullptr; float t0[3], t1[3], t2[3], t3[3]; float t4[3]; float helix_radius; @@ -2210,7 +2210,7 @@ int CartoonExtrudeTube(short use_cylinders_for_strands, CExtrude *ex, CGO *cgo, if (ok) ExtrudeBuildNormals1f(ex); if (ok) - ok &= ExtrudeCGOSurfaceTube(ex, cgo, tube_cap, NULL, use_cylinders_for_strands); + ok &= ExtrudeCGOSurfaceTube(ex, cgo, tube_cap, nullptr, use_cylinders_for_strands); } return ok; } @@ -2244,7 +2244,7 @@ int CartoonExtrudeCircle(CExtrude *ex, CGO *cgo, short use_cylinders_for_strands if (ok) ExtrudeBuildNormals1f(ex); if (ok) - ok &= ExtrudeCGOSurfaceTube(ex, cgo, loop_cap, NULL, use_cylinders_for_strands, dash); + ok &= ExtrudeCGOSurfaceTube(ex, cgo, loop_cap, nullptr, use_cylinders_for_strands, dash); return ok; } @@ -2273,13 +2273,13 @@ int CartoonExtrudeRect(PyMOLGlobals *G, CExtrude *ex, CGO *cgo, float width, flo if (ok) ExtrudeBuildNormals2f(ex); if (ok) - ok &= ExtrudeCGOSurfacePolygon(ex, cgo, cCylCap::Flat, NULL); + ok &= ExtrudeCGOSurfacePolygon(ex, cgo, cCylCap::Flat, nullptr); } else { ok = ExtrudeRectangle(ex, width, length, 1); if (ok) ExtrudeBuildNormals2f(ex); if (ok) - ok &= ExtrudeCGOSurfacePolygon(ex, cgo, cCylCap::None, NULL); + ok &= ExtrudeCGOSurfacePolygon(ex, cgo, cCylCap::None, nullptr); if (ok){ ok &= ExtrudeRectangle(ex, width, length, 2); if (ok) @@ -2299,7 +2299,7 @@ int CartoonExtrudeOval(PyMOLGlobals *G, CExtrude *ex, CGO *cgo, short use_cylind ExtrudeBuildNormals2f(ex); if (ok){ if(highlight_color < 0) - ok &= ExtrudeCGOSurfaceTube(ex, cgo, cCylCap::Flat, NULL, use_cylinders_for_strands); + ok &= ExtrudeCGOSurfaceTube(ex, cgo, cCylCap::Flat, nullptr, use_cylinders_for_strands); else ok &= ExtrudeCGOSurfaceTube(ex, cgo, cCylCap::Flat, ColorGet(G, highlight_color), use_cylinders_for_strands); } @@ -2314,7 +2314,7 @@ int CartoonExtrudeArrow(PyMOLGlobals *G, CExtrude *ex, CGO *cgo, int sampling, f ExtrudeBuildNormals2f(ex); if (ok){ if(highlight_color < 0) - ok &= ExtrudeCGOSurfaceStrand(ex, cgo, sampling, NULL); + ok &= ExtrudeCGOSurfaceStrand(ex, cgo, sampling, nullptr); else ok &= ExtrudeCGOSurfaceStrand(ex, cgo, sampling, ColorGet(G, highlight_color)); } @@ -2335,13 +2335,13 @@ int CartoonExtrudeDumbbell(PyMOLGlobals *G, CExtrude *ex, CGO *cgo, int sampling if (ok) ExtrudeBuildNormals2f(ex); if (ok) - ok &= ExtrudeCGOSurfacePolygonTaper(ex, cgo, sampling, NULL); + ok &= ExtrudeCGOSurfacePolygonTaper(ex, cgo, sampling, nullptr); } else { ok = ExtrudeDumbbell1(ex, dumbbell_width, dumbbell_length, 1); if (ok) ExtrudeBuildNormals2f(ex); if (ok) - ok &= ExtrudeCGOSurfacePolygonTaper(ex, cgo, sampling, NULL); + ok &= ExtrudeCGOSurfacePolygonTaper(ex, cgo, sampling, nullptr); if (ok) ok &= ExtrudeDumbbell1(ex, dumbbell_width, dumbbell_length, 2); if (ok) @@ -2367,7 +2367,7 @@ int CartoonExtrudeDumbbell(PyMOLGlobals *G, CExtrude *ex, CGO *cgo, int sampling ExtrudeBuildNormals1f(ex1); if (ok) - ok &= ExtrudeCGOSurfaceTube(ex1, cgo, cCylCap::Flat, NULL, use_cylinders_for_strands); + ok &= ExtrudeCGOSurfaceTube(ex1, cgo, cCylCap::Flat, nullptr, use_cylinders_for_strands); if (ok){ ExtrudeFree(ex1); ex1 = ExtrudeCopyPointsNormalsColors(ex); @@ -2381,7 +2381,7 @@ int CartoonExtrudeDumbbell(PyMOLGlobals *G, CExtrude *ex, CGO *cgo, int sampling if (ok) ExtrudeBuildNormals1f(ex1); if (ok) - ok &= ExtrudeCGOSurfaceTube(ex1, cgo, cCylCap::Flat, NULL, use_cylinders_for_strands); + ok &= ExtrudeCGOSurfaceTube(ex1, cgo, cCylCap::Flat, nullptr, use_cylinders_for_strands); } if (ex1) ExtrudeFree(ex1); @@ -2418,12 +2418,12 @@ CGO *GenerateRepCartoonCGO(CoordSet *cs, ObjectMolecule *obj, nuc_acid_data *nda int ok = true; CGO *cgo; int contigFlag, contFlag, extrudeFlag, n_p; - CExtrude *ex = NULL; + CExtrude *ex = nullptr; float dev; unsigned int *vi; int atom_index1, atom_index2; float *v, *v1, *v2, *vo; - float *d, *vc = NULL, *vn; + float *d, *vc = nullptr, *vn; float *valpha = nullptr; int *atp; int c1, c2; @@ -2772,7 +2772,7 @@ class nuc_acid_cap { return false; nuc_acid(G, ndata, idx, atm, ai, cs, cs->Obj, false); - set(-1, -1, NULL); + set(-1, -1, nullptr); return true; } }; @@ -2790,7 +2790,7 @@ void RepCartoonGeneratePASS1(PyMOLGlobals *G, RepCartoon *I, ObjectMolecule *obj int a, a1, a3, a4 = 0; char *lv = I->LastVisib; int trace, trace_mode; - AtomInfoType *ai, *last_ai = NULL; + AtomInfoType *ai, *last_ai = nullptr; int cartoon_side_chain_helper; int cylindrical_helices; int fancy_helices; @@ -2997,9 +2997,9 @@ void RepCartoonGeneratePASS1(PyMOLGlobals *G, RepCartoon *I, ObjectMolecule *obj } // pointers to C+N+O coordinates - v_c = NULL; - v_n = NULL; - v_o = NULL; + v_c = nullptr; + v_n = nullptr; + v_o = nullptr; // get start (st) and end (nd) indices of residue atoms AtomInfoBracketResidueFast(G, obj->AtomInfo, obj->NAtom, a1, &st, &nd); @@ -3058,7 +3058,7 @@ void RepCartoonGeneratePASS1(PyMOLGlobals *G, RepCartoon *I, ObjectMolecule *obj } last_ai = ai; - trailing_O3p.set(-1, -1, NULL); + trailing_O3p.set(-1, -1, nullptr); /* 5' cap */ if(leading_O5p.active() @@ -3068,7 +3068,7 @@ void RepCartoonGeneratePASS1(PyMOLGlobals *G, RepCartoon *I, ObjectMolecule *obj leading_O5p.cap(); } - leading_O5p.set(-1, -1, NULL); + leading_O5p.set(-1, -1, nullptr); /* this is the main nucleic acid cartoon section... */ nuc_acid(G, ndata, a, a1, ai, cs, obj, true); @@ -3224,11 +3224,11 @@ void RepCartoonComputeRoundHelices(nuc_acid_data *ndata, const int nAt, for(a = 0; a < nAt; a++) { if(a) { if(*sptr != *(sptr - 1)) { /* contiguous helices in disconnected segments */ - v1 = NULL; - v2 = NULL; - v3 = NULL; - v4 = NULL; - v5 = NULL; + v1 = nullptr; + v2 = nullptr; + v3 = nullptr; + v4 = nullptr; + v5 = nullptr; last = 0; } } @@ -3278,11 +3278,11 @@ void RepCartoonComputeRoundHelices(nuc_acid_data *ndata, const int nAt, } } } - v1 = NULL; - v2 = NULL; - v3 = NULL; - v4 = NULL; - v5 = NULL; + v1 = nullptr; + v2 = nullptr; + v3 = nullptr; + v4 = nullptr; + v5 = nullptr; last = 0; } if(v1 && v2 && v3 && v4) { @@ -3672,21 +3672,21 @@ Rep *RepCartoonNew(CoordSet * cs, int state) ObjectMolecule *obj; int *i, *sptr, *at, *seg, nAt; CCInOut *car, *cc; - float *pv = NULL; - float *pvo = NULL, *pva = NULL; - float *dv = NULL; - float *nv = NULL; - float *tv = NULL; - float *tmp = NULL; - float *dl = NULL; + float *pv = nullptr; + float *pvo = nullptr, *pva = nullptr; + float *dv = nullptr; + float *nv = nullptr; + float *tv = nullptr; + float *tmp = nullptr; + float *dl = nullptr; int ladder_mode; int round_helices; int na_mode; int *flag_tmp; float putty_vals[4] = { 10.0F, 0.0F, FLT_MAX, -FLT_MAX }; // putty_mean, putty_stdev, putty_min, putty_max - int *ring_anchor = NULL; - int *nuc_flag = NULL; + int *ring_anchor = nullptr; + int *nuc_flag = nullptr; float alpha; int ok = true; nuc_acid_data ndata; @@ -3697,7 +3697,7 @@ Rep *RepCartoonNew(CoordSet * cs, int state) // skip if not visible if(!cs->hasRep(cRepCartoonBit)) - return NULL; + return nullptr; /* THIS IS BY FAR THE WORST ROUTINE IN PYMOL! * DEVELOP ON IT ONLY AT EXTREME RISK TO YOUR MENTAL HEALTH */ @@ -3758,7 +3758,7 @@ Rep *RepCartoonNew(CoordSet * cs, int state) ndata.nuc_flag = nuc_flag; ndata.a2 = -1; ndata.nSeg = 0; - ndata.v_o_last = NULL; + ndata.v_o_last = nullptr; ndata.sptr = sptr; ndata.iptr = i; ndata.cc = cc; @@ -3851,7 +3851,7 @@ Rep *RepCartoonNew(CoordSet * cs, int state) if (!ok || !CGOHasOperations(I->preshader)) { /* cannot generate RepCartoon */ delete I; - I = NULL; + I = nullptr; } FreeP(dv); FreeP(dl); diff --git a/layer2/RepCylBond.cpp b/layer2/RepCylBond.cpp index 3a9a988b8..96abcf76f 100644 --- a/layer2/RepCylBond.cpp +++ b/layer2/RepCylBond.cpp @@ -179,7 +179,7 @@ void RepCylBond::render(RenderInfo * info) if(ray) { #ifndef _PYMOL_NO_RAY - CGORenderRay(I->primitiveCGO, ray, info, NULL, NULL, I->cs->Setting.get(), I->obj->Setting.get()); + CGORenderRay(I->primitiveCGO, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->obj->Setting.get()); ray->transparentf(0.0); #endif } else if(G->HaveGUI && G->ValidContext) { @@ -205,7 +205,7 @@ void RepCylBond::render(RenderInfo * info) } const float *color = ColorGet(G, I->obj->Color); I->renderCGO->debug = SettingGetGlobal_i(G, cSetting_stick_debug); - CGORender(I->renderCGO, color, NULL, NULL, info, I); + CGORender(I->renderCGO, color, nullptr, nullptr, info, I); } } } @@ -301,7 +301,7 @@ static int RepValence(RepCylBond *I, CGO *cgo, bool s1, bool s2, bool isRamped, const float *color1, const float *color2, int ord, float tube_size, bool fixed_r, float scale_r, - Pickable pickdata[] = NULL) + Pickable pickdata[] = nullptr) { float d[3], t[3], p0[3], p1[3], p2[3]; const float* vv; @@ -374,7 +374,7 @@ static int RepValence(RepCylBond *I, CGO *cgo, bool s1, bool s2, bool isRamped, ok &= CGOColorv(cgo, color1); if (ok && pickdata) ok &= CGOPickColor(cgo, pickdata[0].index, pickdata[0].bond); - Pickable *pickdataptr = NULL; + Pickable *pickdataptr = nullptr; if (pickdata) pickdataptr = &pickdata[1]; if (ok) @@ -408,7 +408,7 @@ static int RepValence(RepCylBond *I, CGO *cgo, bool s1, bool s2, bool isRamped, copy3f(v1, v1t); copy3f(v2, v2t); - Pickable *pickdataptr = NULL; + Pickable *pickdataptr = nullptr; if (pickdata) pickdataptr = &pickdata[1]; if (ok) @@ -506,7 +506,7 @@ static int RepValence(RepCylBond *I, CGO *cgo, bool s1, bool s2, bool isRamped, ok &= RepCylinder(cgo, s1, s2, isRamped, v1tt, v2tt, true, true, radius2); } - Pickable *pickdataptr = NULL; + Pickable *pickdataptr = nullptr; if (ok) ok &= CGOColorv(cgo, color1); if (ok && pickdata){ @@ -532,7 +532,7 @@ Rep *RepCylBondNew(CoordSet * cs, int state) const BondType *b; float radius; float valence; - int half_bonds, *other = NULL; + int half_bonds, *other = nullptr; int visFlag; int ord; int stick_ball, stick_ball_color = -1; @@ -545,8 +545,8 @@ Rep *RepCylBondNew(CoordSet * cs, int state) int cartoon_side_chain_helper = 0; int ribbon_side_chain_helper = 1; int na_mode; - bool *marked = NULL; - float *capdrawn = NULL; + bool *marked = nullptr; + float *capdrawn = nullptr; float scale_r = 1.0F; float transp, h_scale; float prev_transp = -1; @@ -579,7 +579,7 @@ Rep *RepCylBondNew(CoordSet * cs, int state) marked = pymol::calloc(obj->NAtom); CHECKOK(ok, marked); if (!ok){ - return NULL; + return nullptr; } valence = SettingGet_b(G, cs->Setting.get(), obj->Setting.get(), cSetting_valence); @@ -907,7 +907,7 @@ Rep *RepCylBondNew(CoordSet * cs, int state) CGOStop(I->primitiveCGO); if (!ok){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; @@ -1137,10 +1137,10 @@ void RepCylBondRenderImmediate(CoordSet * cs, RenderInfo * info) } /* overlap is half since it is one cylinder representing both halfs of a bond */ - RepCylinderImmediate(v1, v2, nEdge, 1, 1, overlap_r, nub_r, radius, NULL); + RepCylinderImmediate(v1, v2, nEdge, 1, 1, overlap_r, nub_r, radius, nullptr); } else { /* different colors -> two cylinders, no interior */ - float avg[3], *dir = NULL; + float avg[3], *dir = nullptr; avg[0] = (v1[0] + v2[0]) * _pt5; avg[1] = (v1[1] + v2[1]) * _pt5; diff --git a/layer2/RepDihedral.cpp b/layer2/RepDihedral.cpp index a48f2b85c..7f1a5f934 100644 --- a/layer2/RepDihedral.cpp +++ b/layer2/RepDihedral.cpp @@ -66,14 +66,14 @@ static int RepDihedralCGOGenerate(RepDihedral * I, RenderInfo * info) int c = I->N; float line_width; int ok = true; - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; short dash_as_cylinders = 0; int color = - SettingGet_color(G, NULL, I->ds->Obj->Setting.get(), cSetting_dihedral_color); + SettingGet_color(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dihedral_color); I->linewidth = line_width = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_width); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_width); I->radius = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_radius); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_radius); line_width = SceneGetDynamicLineWidth(info, line_width); @@ -96,7 +96,7 @@ static int RepDihedralCGOGenerate(RepDihedral * I, RenderInfo * info) v = I->V; c = I->N; if (dash_as_cylinders){ - float *origin = NULL, axis[3]; + float *origin = nullptr, axis[3]; while(ok && c > 0) { origin = v; v += 3; @@ -129,7 +129,7 @@ static int RepDihedralCGOGenerate(RepDihedral * I, RenderInfo * info) CHECKOK(ok, convertcgo); CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; if (ok){ if (dash_as_cylinders){ CGO *tmpCGO = CGONew(G); @@ -177,11 +177,11 @@ void RepDihedral::render(RenderInfo * info) int round_ends; int ok = true; int color = - SettingGet_color(G, NULL, I->ds->Obj->Setting.get(), cSetting_dihedral_color); + SettingGet_color(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dihedral_color); float dash_transparency = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_transparency); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_transparency); bool t_mode_3 = - SettingGet_i(G, NULL, I->ds->Obj->Setting.get(), cSetting_transparency_mode) == 3; + SettingGet_i(G, nullptr, I->ds->Obj->Setting.get(), cSetting_transparency_mode) == 3; short dash_transparency_enabled; if(color < 0) color = getObj()->Color; @@ -192,11 +192,11 @@ void RepDihedral::render(RenderInfo * info) return; I->linewidth = line_width = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_width); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_width); I->radius = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_radius); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_radius); round_ends = - SettingGet_b(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_round_ends); + SettingGet_b(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_round_ends); line_width = SceneGetDynamicLineWidth(info, line_width); @@ -253,7 +253,7 @@ void RepDihedral::render(RenderInfo * info) } ok &= RepDihedralCGOGenerate(I, info); } else { - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); return; } } @@ -299,14 +299,14 @@ void RepDihedral::render(RenderInfo * info) if (use_shader) { if (ok) { - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); } } } } if (!ok){ CGOFree(I->shaderCGO); - I->ds->Rep[cRepDihedral] = NULL; + I->ds->Rep[cRepDihedral] = nullptr; delete I; } } @@ -329,8 +329,8 @@ Rep *RepDihedralNew(DistSet * ds, int state) if (ds && ds->getNRep() > cRepDihedral && ds->Rep[cRepDihedral]) I->cs = ds->Rep[cRepDihedral]->cs; - dash_len = SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dash_length); - dash_gap = SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dash_gap); + dash_len = SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dash_length); + dash_gap = SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dash_gap); dash_sum = dash_len + dash_gap; if(dash_sum < R_SMALL4) dash_sum = 0.5; @@ -351,7 +351,7 @@ Rep *RepDihedralNew(DistSet * ds, int state) float d3[3], n1[3], n3[3], x[3], y[3]; float radius, length, angle, phase, pos; float dihedral_size = - SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dihedral_size); + SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dihedral_size); I->V = VLAlloc(float, ds->NDihedralIndex * 10); CHECKOK(ok, I->V); @@ -529,7 +529,7 @@ Rep *RepDihedralNew(DistSet * ds, int state) } if (!ok){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/RepDistDash.cpp b/layer2/RepDistDash.cpp index 92fb788cc..9ed52c586 100644 --- a/layer2/RepDistDash.cpp +++ b/layer2/RepDistDash.cpp @@ -68,7 +68,7 @@ static void RepDistDashCGOGenerate(RepDistDash * I) float *v = I->V; int c = I->N; int color = - SettingGet_color(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_color); + SettingGet_color(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_color); short dash_as_cylinders = 0; dash_as_cylinders = SettingGetGlobal_b(G, cSetting_render_as_cylinders) && SettingGetGlobal_b(G, cSetting_dash_as_cylinders); @@ -88,7 +88,7 @@ static void RepDistDashCGOGenerate(RepDistDash * I) v = I->V; c = I->N; if (dash_as_cylinders){ - float *origin = NULL, axis[3]; + float *origin = nullptr, axis[3]; while(ok && c > 0) { origin = v; v += 3; @@ -125,13 +125,13 @@ void RepDistDash::render(RenderInfo* info) int round_ends; int ok = true; int color = - SettingGet_color(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_color); + SettingGet_color(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_color); float line_width = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_width); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_width); float dash_transparency = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_transparency); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_transparency); bool t_mode_3 = - SettingGet_i(G, NULL, I->ds->Obj->Setting.get(), cSetting_transparency_mode) == 3; + SettingGet_i(G, nullptr, I->ds->Obj->Setting.get(), cSetting_transparency_mode) == 3; short dash_transparency_enabled; dash_transparency = (dash_transparency < 0.f ? 0.f : (dash_transparency > 1.f ? 1.f : dash_transparency)); dash_transparency_enabled = (dash_transparency > 0.f); @@ -143,9 +143,9 @@ void RepDistDash::render(RenderInfo* info) color = getObj()->Color; I->radius = - SettingGet_f(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_radius); + SettingGet_f(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_radius); round_ends = - SettingGet_b(G, NULL, I->ds->Obj->Setting.get(), cSetting_dash_round_ends); + SettingGet_b(G, nullptr, I->ds->Obj->Setting.get(), cSetting_dash_round_ends); line_width = SceneGetDynamicLineWidth(info, line_width); if(ray) { @@ -208,7 +208,7 @@ void RepDistDash::render(RenderInfo* info) } RepDistDashCGOGenerate(I); } else if (ok) { - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); return; } } @@ -253,7 +253,7 @@ void RepDistDash::render(RenderInfo* info) #endif if (use_shader) { if (generate_shader_cgo){ - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; if (ok) ok &= CGOStop(I->shaderCGO); { @@ -264,7 +264,7 @@ void RepDistDash::render(RenderInfo* info) CHECKOK(ok, convertcgo); CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; } if (ok){ if (dash_as_cylinders){ @@ -308,19 +308,19 @@ void RepDistDash::render(RenderInfo* info) if (convertcgo){ CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; } } if (ok) { - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); } } } } if (!ok){ CGOFree(I->shaderCGO); - I->ds->Rep[cRepDash] = NULL; + I->ds->Rep[cRepDash] = nullptr; delete I; } } @@ -341,8 +341,8 @@ Rep *RepDistDashNew(DistSet * ds, int state) auto I = new RepDistDash(ds->Obj, state); - dash_len = SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dash_length); - dash_gap = SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dash_gap); + dash_len = SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dash_length); + dash_gap = SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dash_gap); dash_sum = dash_len + dash_gap; if(dash_sum < R_SMALL4) dash_sum = 0.5; @@ -420,7 +420,7 @@ Rep *RepDistDashNew(DistSet * ds, int state) } if (!ok){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/RepDistLabel.cpp b/layer2/RepDistLabel.cpp index 9b5ee943f..1d43f5d3a 100644 --- a/layer2/RepDistLabel.cpp +++ b/layer2/RepDistLabel.cpp @@ -79,14 +79,14 @@ void RepDistLabel::render(RenderInfo* info) int c = I->N; DistLabel *l = I->L; int n = 0; - int font_id = SettingGet_i(G, NULL, obj->Setting.get(), cSetting_label_font_id); - float font_size = SettingGet_f(G, NULL, obj->Setting.get(), cSetting_label_size); - int float_text = SettingGet_i(G, NULL, obj->Setting.get(), cSetting_float_labels); + int font_id = SettingGet_i(G, nullptr, obj->Setting.get(), cSetting_label_font_id); + float font_size = SettingGet_f(G, nullptr, obj->Setting.get(), cSetting_label_size); + int float_text = SettingGet_i(G, nullptr, obj->Setting.get(), cSetting_float_labels); int ok = true; short use_shader = SettingGetGlobal_b(G, cSetting_use_shaders); if (I->MaxInvalid >= cRepInvRep) return; - font_id = SettingCheckFontID(G, NULL, obj->Setting.get(), font_id); + font_id = SettingCheckFontID(G, nullptr, obj->Setting.get(), font_id); if (I->shaderCGO && font_size < 0.f){ int size; @@ -118,7 +118,7 @@ void RepDistLabel::render(RenderInfo* info) if (I->shaderCGO){ if(float_text) glDisable(GL_DEPTH_TEST); - CGORenderPicking(I->shaderCGO, info, &I->context, NULL, NULL); + CGORenderPicking(I->shaderCGO, info, &I->context, nullptr, nullptr); if(float_text) glEnable(GL_DEPTH_TEST); return; @@ -137,7 +137,7 @@ void RepDistLabel::render(RenderInfo* info) AssignNewPickColor(nullptr, pick, TextGetColorUChar4uv(G), &I->context, p->index, p->bond); TextSetColorFromUColor(G); - TextSetLabelBkgrdInfo(G, 1.f, 1.2f, NULL); + TextSetLabelBkgrdInfo(G, 1.f, 1.2f, nullptr); TextSetLabelPosIsSet(G, 0); if (!TextRenderOpenGL(G, info, font_id, l[n], font_size, v + 3, false, 0, 1, 0)){ TextSetIsPicking(G, false); @@ -164,7 +164,7 @@ void RepDistLabel::render(RenderInfo* info) } } else { info->texture_font_size = I->texture_font_size; - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); return; } } else if (I->shaderCGO){ @@ -180,7 +180,7 @@ void RepDistLabel::render(RenderInfo* info) if (ok && I->shaderCGO) ok &= CGOPickColor(I->shaderCGO, p->index, p->bond); TextSetPos(G, v); - TextSetLabelBkgrdInfo(G, 1.f, 1.2f, NULL); + TextSetLabelBkgrdInfo(G, 1.f, 1.2f, nullptr); TextSetLabelPosIsSet(G, 0); if (!TextRenderOpenGL(G, info, font_id, l[n], font_size, v + 3, false, 0, 1, SHADERCGO)) return; @@ -209,7 +209,7 @@ void RepDistLabel::render(RenderInfo* info) CHECKOK(ok, convertcgo); CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; } if (ok && I->shaderCGO){ I->shaderCGO->use_shader = true; @@ -223,7 +223,7 @@ void RepDistLabel::render(RenderInfo* info) } if (!ok){ CGOFree(I->shaderCGO); - I->ds->Rep[cRepLabel] = NULL; + I->ds->Rep[cRepLabel] = nullptr; delete I; } } @@ -236,10 +236,10 @@ Rep *RepDistLabelNew(DistSet * ds, int state) float *v, *v1, *v2, *v3, d[3], di; char buffer[255]; const float *lab_pos = - SettingGet_3fv(G, NULL, ds->Obj->Setting.get(), cSetting_label_position); + SettingGet_3fv(G, nullptr, ds->Obj->Setting.get(), cSetting_label_position); int default_digits = - SettingGet_i(G, NULL, ds->Obj->Setting.get(), cSetting_label_digits); - Pickable *rp = NULL; + SettingGet_i(G, nullptr, ds->Obj->Setting.get(), cSetting_label_digits); + Pickable *rp = nullptr; if(!(ds->NIndex || ds->NAngleIndex || ds->NDihedralIndex)) { ds->LabCoord.clear(); @@ -254,7 +254,7 @@ Rep *RepDistLabelNew(DistSet * ds, int state) I->ds = ds; I->OutlineColor = - SettingGet_i(G, NULL, ds->Obj->Setting.get(), cSetting_label_outline_color); + SettingGet_i(G, nullptr, ds->Obj->Setting.get(), cSetting_label_outline_color); int nLabel = 0; int ok = true; @@ -264,7 +264,7 @@ Rep *RepDistLabelNew(DistSet * ds, int state) ds->LabCoord.resize(nLabel); ds->LabPos.resize(nLabel); - if(SettingGet_b(G, NULL, ds->Obj->Setting.get(), cSetting_pickable)) { + if(SettingGet_b(G, nullptr, ds->Obj->Setting.get(), cSetting_pickable)) { I->P = pymol::malloc(nLabel + 1); CHECKOK(ok, I->P); if (ok) @@ -282,7 +282,7 @@ Rep *RepDistLabelNew(DistSet * ds, int state) auto* lc = ds->LabCoord.data(); if(ds->NIndex) { - int digits = SettingGet_i(G, NULL, ds->Obj->Setting.get(), + int digits = SettingGet_i(G, nullptr, ds->Obj->Setting.get(), cSetting_label_distance_digits); WordType format; if(digits < 0) @@ -342,7 +342,7 @@ Rep *RepDistLabelNew(DistSet * ds, int state) float l1, l2; float radius; - int digits = SettingGet_i(G, NULL, ds->Obj->Setting.get(), + int digits = SettingGet_i(G, nullptr, ds->Obj->Setting.get(), cSetting_label_angle_digits); WordType format; if(digits < 0) @@ -371,8 +371,8 @@ Rep *RepDistLabelNew(DistSet * ds, int state) else radius = l1; radius *= - SettingGet_f(G, NULL, ds->Obj->Setting.get(), - cSetting_angle_size) * SettingGet_f(G, NULL, + SettingGet_f(G, nullptr, ds->Obj->Setting.get(), + cSetting_angle_size) * SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_angle_label_position); @@ -430,13 +430,13 @@ Rep *RepDistLabelNew(DistSet * ds, int state) float l1, l2; float radius; float dihedral_size = - SettingGet_f(G, NULL, ds->Obj->Setting.get(), cSetting_dihedral_size); - float dihedral_label_position = SettingGet_f(G, NULL, ds->Obj->Setting.get(), + SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dihedral_size); + float dihedral_label_position = SettingGet_f(G, nullptr, ds->Obj->Setting.get(), cSetting_dihedral_label_position); float *v4; float avg[3]; - int digits = SettingGet_i(G, NULL, ds->Obj->Setting.get(), + int digits = SettingGet_i(G, nullptr, ds->Obj->Setting.get(), cSetting_label_dihedral_digits); WordType format; if(digits < 0) @@ -531,7 +531,7 @@ Rep *RepDistLabelNew(DistSet * ds, int state) } if (!ok){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/RepDot.cpp b/layer2/RepDot.cpp index 38a4d1e23..d096e1582 100644 --- a/layer2/RepDot.cpp +++ b/layer2/RepDot.cpp @@ -58,7 +58,7 @@ static int RepDotCGOGenerate(RepDot * I) int c = I->N; int cc = 0; int ok = true; - CGO *cgo = NULL; + CGO *cgo = nullptr; int normals = SettingGet_i(G, I->cs->Setting.get(), I->obj->Setting.get(), cSetting_dot_normals); @@ -197,7 +197,7 @@ void RepDot::render(RenderInfo * info) if (ok) { const float *color; color = ColorGet(G, I->obj->Color); - CGORender(I->shaderCGO, color, NULL, NULL, info, I); + CGORender(I->shaderCGO, color, nullptr, nullptr, info, I); return; /* should not do any other rendering after shaderCGO has been rendered */ } @@ -261,10 +261,10 @@ Rep *RepDotDoNew(CoordSet * cs, cRepDot_t mode, int state) { PyMOLGlobals *G = cs->G; float *v, *vn; - float *aa = NULL; - int *tp = NULL; - int *tf = NULL; - float *countPtr = NULL; + float *aa = nullptr; + int *tp = nullptr; + int *tf = nullptr; + float *countPtr = nullptr; int* ati = nullptr; auto obj = cs->Obj; diff --git a/layer2/RepEllipsoid.cpp b/layer2/RepEllipsoid.cpp index 8f10422d1..b27946db0 100644 --- a/layer2/RepEllipsoid.cpp +++ b/layer2/RepEllipsoid.cpp @@ -67,7 +67,7 @@ void RepEllipsoid::render(RenderInfo* info) " RepEllipsoidRender: rendering ray...\n" ENDFD; if(I->ray){ - int rayok = CGORenderRay(I->ray, ray, info, NULL, NULL, I->cs->Setting.get(), I->obj->Setting.get()); + int rayok = CGORenderRay(I->ray, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->obj->Setting.get()); if (!rayok){ CGOFree(I->ray); try_std = true; @@ -76,7 +76,7 @@ void RepEllipsoid::render(RenderInfo* info) try_std = true; } if(try_std && I->std){ - ok &= CGORenderRay(I->std, ray, info, NULL, NULL, I->cs->Setting.get(), I->obj->Setting.get()); + ok &= CGORenderRay(I->std, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->obj->Setting.get()); if (!ok){ CGOFree(I->std); } @@ -108,9 +108,9 @@ void RepEllipsoid::render(RenderInfo* info) CGOFree(I->shaderCGO); } if (I->shaderCGO){ - CGORender(I->shaderCGO, NULL, I->cs->Setting.get(), I->obj->Setting.get(), info, I); + CGORender(I->shaderCGO, nullptr, I->cs->Setting.get(), I->obj->Setting.get(), info, I); } else if(I->std){ - CGORender(I->std, NULL, I->cs->Setting.get(), I->obj->Setting.get(), info, I); + CGORender(I->std, nullptr, I->cs->Setting.get(), I->obj->Setting.get(), info, I); } } } @@ -155,12 +155,12 @@ Rep *RepEllipsoidNew(CoordSet * cs, int state) // skip if no dots are visible if(!cs->hasRep(cRepEllipsoidBit)) - return NULL; + return nullptr; auto I = new RepEllipsoid(cs, state); CHECKOK(ok, I); if (!ok) - return NULL; + return nullptr; obj = cs->Obj; @@ -206,7 +206,7 @@ Rep *RepEllipsoidNew(CoordSet * cs, int state) float last_alpha = 1.0F; double *csmatrix = SettingGet_i(G, cs->Setting.get(), obj->Setting.get(), - cSetting_matrix_mode) > 0 ? NULL : cs->Matrix.data(); + cSetting_matrix_mode) > 0 ? nullptr : cs->Matrix.data(); for(a = 0; a < cs->NIndex; a++) { a1 = cs->IdxToAtm[a]; @@ -339,7 +339,7 @@ Rep *RepEllipsoidNew(CoordSet * cs, int state) } if (!ok){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/RepLabel.cpp b/layer2/RepLabel.cpp index 9f89765a3..158de0661 100644 --- a/layer2/RepLabel.cpp +++ b/layer2/RepLabel.cpp @@ -106,7 +106,7 @@ short InvalidateShaderCGOIfTextureNeedsUpdate(PyMOLGlobals *G, float font_size, float v_scale, perc = 0.f; int size, diff; short inv = false; - v_scale = SceneGetScreenVertexScale(G, NULL); + v_scale = SceneGetScreenVertexScale(G, nullptr); size = (int) (0.5F - font_size / v_scale); if (size <= 0) size = 1; @@ -457,7 +457,7 @@ void RepLabelRenderBackgroundInImmediate(PyMOLGlobals *G, RepLabel *I, float *v, {// taking into account screen adjustments : indent and screen world offset to the label point float v_scale, xn[3], yn[3]; - v_scale = SceneGetScreenVertexScale(G, NULL); + v_scale = SceneGetScreenVertexScale(G, nullptr); SceneGetScaledAxesAtPoint(G, labelpos, xn, yn); addXYtoVertex(indentFactorT[0] + screenWorldOffset[0]/v_scale, indentFactorT[1] + screenWorldOffset[1]/v_scale, xn, yn, labelpos, pos); } @@ -469,7 +469,7 @@ void RepLabelRenderBackgroundInImmediate(PyMOLGlobals *G, RepLabel *I, float *v, float dVectorInPixels[2], dVector[2]; float v_scale; short visible; - v_scale = SceneGetScreenVertexScale(G, NULL); + v_scale = SceneGetScreenVertexScale(G, nullptr); copy3f(v+6, tCenter); tCenter[3] = 1.f; @@ -1280,8 +1280,8 @@ void RepLabel::render(RenderInfo* info) if(c) { const char *st; short use_shader, has_connector = 0; - CGO *connectorCGO = NULL; - float *PmvMatrix = NULL; + CGO *connectorCGO = nullptr; + float *PmvMatrix = nullptr; int screenwidth, screenheight; float xn[3] = { 1.0F, 0.0F, 0.0F }; float yn[3] = { 0.0F, 1.0F, 0.0F }; @@ -1303,7 +1303,7 @@ void RepLabel::render(RenderInfo* info) info->texture_font_size = I->texture_font_size; if(float_text) glDisable(GL_DEPTH_TEST); - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); if(float_text) glEnable(GL_DEPTH_TEST); return; @@ -1388,7 +1388,7 @@ void RepLabel::render(RenderInfo* info) } if (draw_var){ - float *RotMatrix = NULL; + float *RotMatrix = nullptr; float *screenWorldOffset = TextGetScreenWorldOffset(G); float text_width = TextGetWidth(G), text_height = TextGetHeight(G); float *indentFactor = TextGetIndentFactor(G); @@ -1437,8 +1437,8 @@ void RepLabel::render(RenderInfo* info) } if (I->shaderCGO){ - CGO *totalCGO = NULL; - CGO *labelCGO = NULL; + CGO *totalCGO = nullptr; + CGO *labelCGO = nullptr; CGOStop(I->shaderCGO); CGO * tmpCGO = CGONew(G); CGOEnable(tmpCGO, GL_LABEL_SHADER); @@ -1450,7 +1450,7 @@ void RepLabel::render(RenderInfo* info) if (!labelCGO) return; CGOFree(I->shaderCGO); if (connectorCGO){ - CGO *tmpCGO = NULL; + CGO *tmpCGO = nullptr; tmpCGO = CGOOptimizeConnectors(connectorCGO, 0); CGOFree(connectorCGO); connectorCGO = tmpCGO; @@ -1507,12 +1507,12 @@ Rep *RepLabelNew(CoordSet * cs, int state) const float *vc; lexidx_t *l; int label_color; - Pickable *rp = NULL; + Pickable *rp = nullptr; AtomInfoType *ai; // skip if no labels are visible if(!cs->hasRep(cRepLabelBit)) - return NULL; + return nullptr; auto I = new RepLabel(cs, state); obj = cs->Obj; diff --git a/layer2/RepMesh.cpp b/layer2/RepMesh.cpp index 154ab31d1..e8bcbfce9 100644 --- a/layer2/RepMesh.cpp +++ b/layer2/RepMesh.cpp @@ -246,14 +246,14 @@ static int RepMeshCGOGenerate(RepMesh * I, RenderInfo * info) if (use_shader) { if (ok){ - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; ok &= CGOStop(I->shaderCGO); if (ok) convertcgo = CGOCombineBeginEnd(I->shaderCGO, 0); CHECKOK(ok, convertcgo); CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; if (ok){ if (dot_as_spheres){ CGO *tmpCGO = CGONew(G); @@ -296,7 +296,7 @@ static int RepMeshCGOGenerate(RepMesh * I, RenderInfo * info) convertcgo->use_shader = true; CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; - convertcgo = NULL; + convertcgo = nullptr; } } } @@ -312,7 +312,7 @@ void RepMesh::render(RenderInfo* info) float *vc = I->VC; int *n = I->N.data(); int c; - const float *col = NULL; + const float *col = nullptr; float line_width = SceneGetDynamicLineWidth(info, I->Width); bool const dot_as_spheres = I->mesh_type == cIsomeshMode::isodot && SettingGet(*cs, cSetting_dot_as_spheres); @@ -410,7 +410,7 @@ void RepMesh::render(RenderInfo* info) I->shaderCGO->use_shader = true; generate_shader_cgo = 1; } else if (ok) { - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); return; } } @@ -527,7 +527,7 @@ void RepMesh::render(RenderInfo* info) { const float *color; color = ColorGet(G, I->obj->Color); - CGORender(I->shaderCGO, color, NULL, NULL, info, I); + CGORender(I->shaderCGO, color, nullptr, nullptr, info, I); } } } @@ -619,11 +619,11 @@ Rep* RepMesh::recolor() I->VC = pymol::malloc(3 * I->NTot); vc = I->VC; /* now, assign colors to each point */ - map = MapNew(G, I->max_vdw + probe_radius, cs->Coord, cs->NIndex, NULL); + map = MapNew(G, I->max_vdw + probe_radius, cs->Coord, cs->NIndex, nullptr); if(map) { MapSetupExpress(map); for(a = 0; a < I->NTot; a++) { - AtomInfoType *ai0 = NULL; + AtomInfoType *ai0 = nullptr; c1 = 1; minDist = FLT_MAX; i0 = -1; @@ -707,7 +707,7 @@ Rep *RepMeshNew(CoordSet * cs, int state) ObjectMolecule *obj; CoordSet *ccs; int a, b, c, d, h, k, l, *n; - MapType *map = NULL, *smap = NULL; + MapType *map = nullptr, *smap = nullptr; /* grid */ Vector3f minE, maxE, sizeE; float size; @@ -772,14 +772,14 @@ Rep *RepMeshNew(CoordSet * cs, int state) min_spacing = SettingGet_f(G, cs->Setting.get(), obj->Setting.get(), cSetting_min_mesh_spacing); - I->N = NULL; + I->N = nullptr; I->NTot = 0; - I->V = NULL; - I->VC = NULL; + I->V = nullptr; + I->VC = nullptr; I->NDot = 0; - I->Dot = NULL; - I->LastVisib = NULL; - I->LastColor = NULL; + I->Dot = nullptr; + I->LastVisib = nullptr; + I->LastColor = nullptr; I->mesh_type = mesh_type; I->Radius = SettingGet_f(G, cs->Setting.get(), obj->Setting.get(), cSetting_mesh_radius); I->shaderCGO = 0; @@ -790,24 +790,24 @@ Rep *RepMeshNew(CoordSet * cs, int state) float trim_cutoff = SettingGet_f(G, cs->Setting.get(), obj->Setting.get(), cSetting_mesh_cutoff); int trim_flag = false; - float *trim_vla = NULL; - MapType *trim_map = NULL; + float *trim_vla = nullptr; + MapType *trim_map = nullptr; int carve_state = 0; int carve_flag = false; float carve_cutoff = SettingGet_f(G, cs->Setting.get(), obj->Setting.get(), cSetting_mesh_carve_cutoff); - const char *carve_selection = NULL; - float *carve_vla = NULL; - MapType *carve_map = NULL; + const char *carve_selection = nullptr; + float *carve_vla = nullptr; + MapType *carve_map = nullptr; int clear_state = 0; int clear_flag = false; float clear_cutoff = SettingGet_f(G, cs->Setting.get(), obj->Setting.get(), cSetting_mesh_clear_cutoff); - const char *clear_selection = NULL; - float *clear_vla = NULL; - MapType *clear_map = NULL; + const char *clear_selection = nullptr; + float *clear_vla = nullptr; + MapType *clear_map = nullptr; int mesh_max = SettingGet_i(G, cs->Setting.get(), obj->Setting.get(), cSetting_mesh_grid_max); if(mesh_max < 1) @@ -840,7 +840,7 @@ Rep *RepMeshNew(CoordSet * cs, int state) } } if(ok && nc) { - trim_map = MapNew(G, trim_cutoff, trim_vla, nc, NULL); + trim_map = MapNew(G, trim_cutoff, trim_vla, nc, nullptr); CHECKOK(ok, trim_map); if(ok) { ok &= MapSetupExpress(trim_map); @@ -951,8 +951,8 @@ Rep *RepMeshNew(CoordSet * cs, int state) if(ok && !solv_acc) ok &= RepMeshGetSolventDots(I, cs, minE, maxE, probe_radius); if(ok) { - smap = MapNew(G, probe_radius, I->Dot, I->NDot, NULL); - map = MapNew(G, I->max_vdw + probe_radius, cs->Coord, cs->NIndex, NULL); + smap = MapNew(G, probe_radius, I->Dot, I->NDot, nullptr); + map = MapNew(G, I->max_vdw + probe_radius, cs->Coord, cs->NIndex, nullptr); } if(ok && map && smap) { ok &= MapSetupExpress(smap); @@ -1048,7 +1048,7 @@ Rep *RepMeshNew(CoordSet * cs, int state) FreeP(I->Dot); OrthoBusyFast(G, 2, 3); if(ok) { - ok &= IsosurfVolume(G, NULL, NULL, field, 1.0, I->N, I->V, NULL, mesh_type, mesh_skip, + ok &= IsosurfVolume(G, nullptr, nullptr, field, 1.0, I->N, I->V, nullptr, mesh_type, mesh_skip, 1.0F); } DeleteP(field); @@ -1063,7 +1063,7 @@ Rep *RepMeshNew(CoordSet * cs, int state) CHECKOK(ok, new_n); while(ok && (c = *(n++))) { int new_c = 0; - float *last_v = NULL; + float *last_v = nullptr; while(c--) { int a_keeper = false; if(trim_map) { @@ -1127,14 +1127,14 @@ Rep *RepMeshNew(CoordSet * cs, int state) *(new_v++) = *(v++); *(new_v++) = *(v++); *(new_v++) = *(v++); - last_v = NULL; + last_v = nullptr; } else { last_v = v; v += 3; } } } else { - last_v = NULL; + last_v = nullptr; v += 3; if(new_c) { VLACheck(new_n, int, new_size + 1); /* extends the zero count sentinel */ @@ -1176,7 +1176,7 @@ Rep *RepMeshNew(CoordSet * cs, int state) OrthoBusyFast(G, 4, 4); if(!ok) { delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } @@ -1218,7 +1218,7 @@ int RepMeshGetSolventDots(RepMesh * I, CoordSet * cs, float *min, float *max, probe_radius_plus = probe_radius * 1.5F; I->NDot = 0; - map = MapNew(G, I->max_vdw + probe_radius, cs->Coord, cs->NIndex, NULL); + map = MapNew(G, I->max_vdw + probe_radius, cs->Coord, cs->NIndex, nullptr); if(map) { MapSetupExpress(map); maxCnt = 0; @@ -1297,7 +1297,7 @@ int RepMeshGetSolventDots(RepMesh * I, CoordSet * cs, float *min, float *max, } dot_flag[maxDot] = 1; /* this guarantees that we have a valid dot */ - map = MapNew(G, probe_radius_plus, I->Dot, I->NDot, NULL); + map = MapNew(G, probe_radius_plus, I->Dot, I->NDot, nullptr); if(map) { MapSetupExpress(map); diff --git a/layer2/RepNonbonded.cpp b/layer2/RepNonbonded.cpp index 7cfe21afc..520bb29e5 100644 --- a/layer2/RepNonbonded.cpp +++ b/layer2/RepNonbonded.cpp @@ -121,7 +121,7 @@ static int RepNonbondedCGOGenerate(RepNonbonded * I, RenderInfo * info) PyMOLGlobals *G = I->G; float alpha; int ok = true; - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; short nonbonded_as_cylinders ; short use_shader; float nonbonded_size = @@ -180,7 +180,7 @@ static int RepNonbondedCGOGenerate(RepNonbonded * I, RenderInfo * info) CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; I->shaderCGO->use_shader = use_shader; - convertcgo = NULL; + convertcgo = nullptr; } } else { // no shaders @@ -188,7 +188,7 @@ static int RepNonbondedCGOGenerate(RepNonbonded * I, RenderInfo * info) CGOFree(I->shaderCGO); I->shaderCGO = convertcgo; I->shaderCGO->use_shader = use_shader; - convertcgo = NULL; + convertcgo = nullptr; } return ok; } @@ -206,7 +206,7 @@ void RepNonbonded::render(RenderInfo* info) alpha = 1.0F; if(ray) { #ifndef _PYMOL_NO_RAY - CGORenderRay(I->primitiveCGO, ray, info, NULL, NULL, I->cs->Setting.get(), I->cs->Obj->Setting.get()); + CGORenderRay(I->primitiveCGO, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->cs->Obj->Setting.get()); ray->transparentf(0.0); #endif } else if(G->HaveGUI && G->ValidContext) { @@ -216,7 +216,7 @@ void RepNonbonded::render(RenderInfo* info) /* not pick, but render */ bool use_shader = SettingGetGlobal_b(G, cSetting_nonbonded_use_shader) && SettingGetGlobal_b(G, cSetting_use_shaders); if (!use_shader){ - CGORender(I->primitiveCGO, NULL, NULL, NULL, info, I); + CGORender(I->primitiveCGO, nullptr, nullptr, nullptr, info, I); return; } bool nonbonded_as_cylinders = SettingGetGlobal_b(G, cSetting_render_as_cylinders) && SettingGetGlobal_b(G, cSetting_nonbonded_as_cylinders); @@ -238,7 +238,7 @@ void RepNonbonded::render(RenderInfo* info) } ok &= RepNonbondedCGOGenerate(I, info); } - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); } } } @@ -265,7 +265,7 @@ Rep *RepNonbondedNew(CoordSet * cs, int state) auto I = new RepNonbonded(cs, state); - I->shaderCGO = NULL; + I->shaderCGO = nullptr; I->primitiveCGO = CGONew(G); diff --git a/layer2/RepNonbondedSphere.cpp b/layer2/RepNonbondedSphere.cpp index 8f40656bb..978f4ce00 100644 --- a/layer2/RepNonbondedSphere.cpp +++ b/layer2/RepNonbondedSphere.cpp @@ -59,7 +59,7 @@ void RepNonbondedSphere::render(RenderInfo* info) if(ray) { #ifndef _PYMOL_NO_RAY - CGORenderRay(I->primitiveCGO, ray, info, NULL, NULL, I->cs->Setting.get(), I->obj->Setting.get()); + CGORenderRay(I->primitiveCGO, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->obj->Setting.get()); #endif } else if(G->HaveGUI && G->ValidContext) { if(pick) { @@ -91,9 +91,9 @@ void RepNonbondedSphere::render(RenderInfo* info) } I->shaderCGO->use_shader = true; } - CGORender(I->shaderCGO, NULL, I->cs->Setting.get(), I->obj->Setting.get(), info, I); + CGORender(I->shaderCGO, nullptr, I->cs->Setting.get(), I->obj->Setting.get(), info, I); } else { - CGORender(I->primitiveCGO, NULL, I->cs->Setting.get(), I->obj->Setting.get(), info, I); + CGORender(I->primitiveCGO, nullptr, I->cs->Setting.get(), I->obj->Setting.get(), info, I); } } } @@ -109,7 +109,7 @@ Rep *RepNonbondedSphereNew(CoordSet * cs, int state) PyMOLGlobals *G = cs->G; ObjectMolecule *obj = cs->Obj; - unsigned char *active = NULL; + unsigned char *active = nullptr; int nSphere = 0; float prev_transp = -1; @@ -138,8 +138,8 @@ Rep *RepNonbondedSphereNew(CoordSet * cs, int state) SettingGet_f(G, cs->Setting.get(), obj->Setting.get(), cSetting_nb_spheres_size); auto I = new RepNonbondedSphere(cs, state); - I->shaderCGO = NULL; - I->primitiveCGO = NULL; + I->shaderCGO = nullptr; + I->primitiveCGO = nullptr; /* Generate primitiveCGO */ int NP = 0; @@ -181,7 +181,7 @@ Rep *RepNonbondedSphereNew(CoordSet * cs, int state) FreeP(active); if (!ok){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/RepRibbon.cpp b/layer2/RepRibbon.cpp index 7e90ab9e6..2bbf6dcb7 100644 --- a/layer2/RepRibbon.cpp +++ b/layer2/RepRibbon.cpp @@ -72,7 +72,7 @@ void RepRibbon::render(RenderInfo* info) if(ray) { #ifndef _PYMOL_NO_RAY - CGORenderRay(I->primitiveCGO, ray, info, NULL, NULL, I->cs->Setting.get(), I->obj->Setting.get()); + CGORenderRay(I->primitiveCGO, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->obj->Setting.get()); #endif } else if(G->HaveGUI && G->ValidContext) { if(pick) { @@ -89,7 +89,7 @@ void RepRibbon::render(RenderInfo* info) if (use_shader){ if (!I->shaderCGO){ - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; I->shaderCGO = CGONew(G); CHECKOK(ok, I->shaderCGO); if (ok) @@ -123,10 +123,10 @@ void RepRibbon::render(RenderInfo* info) CGOFreeWithoutVBOs(convertcgo); I->shaderCGO->use_shader = true; } - CGORender(I->shaderCGO, NULL, I->cs->Setting.get(), I->obj->Setting.get(), info, I); + CGORender(I->shaderCGO, nullptr, I->cs->Setting.get(), I->obj->Setting.get(), info, I); return; } else { - CGORender(I->primitiveCGO, NULL, I->cs->Setting.get(), I->obj->Setting.get(), info, I); + CGORender(I->primitiveCGO, nullptr, I->cs->Setting.get(), I->obj->Setting.get(), info, I); return; } } @@ -144,14 +144,14 @@ Rep *RepRibbonNew(CoordSet * cs, int state) ObjectMolecule *obj; int a, b, a1, a2, *i, *s, *at, *seg, nAt, *atp; float *v, *v1, *v2, *v3; - float *pv = NULL; - float *dv = NULL; - float *nv = NULL; - float *tv = NULL; + float *pv = nullptr; + float *dv = nullptr; + float *nv = nullptr; + float *tv = nullptr; float f0, f1, f2, f3, f4; float *d; - float *dl = NULL; + float *dl = nullptr; int nSeg; int sampling; float power_a = 5; @@ -161,13 +161,13 @@ Rep *RepRibbonNew(CoordSet * cs, int state) int trace, trace_mode; int ribbon_color; int na_mode; - AtomInfoType *ai, *last_ai = NULL; - AtomInfoType *trailing_O3p_ai = NULL, *leading_O5p_ai = NULL; + AtomInfoType *ai, *last_ai = nullptr; + AtomInfoType *trailing_O3p_ai = nullptr, *leading_O5p_ai = nullptr; int trailing_O3p_a = 0, leading_O5p_a = 0, leading_O5p_a1 = 0; // skip if not visible if(!cs->hasRep(cRepRibbonBit)) - return NULL; + return nullptr; auto I = new RepRibbon(cs, state); @@ -269,7 +269,7 @@ Rep *RepRibbonNew(CoordSet * cs, int state) } } - trailing_O3p_ai = NULL; + trailing_O3p_ai = nullptr; if(leading_O5p_ai && (a2 < 0) && ((na_mode == 3) || (na_mode == 4))) { if((!AtomInfoSameResidueP(G, ai, leading_O5p_ai)) && @@ -285,7 +285,7 @@ Rep *RepRibbonNew(CoordSet * cs, int state) a2 = leading_O5p_a1; } } - leading_O5p_ai = NULL; + leading_O5p_ai = nullptr; last_ai = ai; if(a2 < 0) nSeg++; @@ -421,7 +421,7 @@ Rep *RepRibbonNew(CoordSet * cs, int state) I->primitiveCGO = CGONew(G); CGOSpecialWithArg(I->primitiveCGO, LINE_LIGHTING, 0.f); - float alpha = 1.f - SettingGet_f(G, NULL, I->obj->Setting.get(), cSetting_ribbon_transparency); + float alpha = 1.f - SettingGet_f(G, nullptr, I->obj->Setting.get(), cSetting_ribbon_transparency); if(fabs(alpha-1.0) < R_SMALL4) alpha = 1.0F; CGOAlpha(I->primitiveCGO, alpha); // would be good to set these at render time instead @@ -538,7 +538,7 @@ Rep *RepRibbonNew(CoordSet * cs, int state) FreeP(nv); } else { delete I; - I = NULL; + I = nullptr; } FreeP(at); @@ -561,7 +561,7 @@ void RepRibbonRenderImmediate(CoordSet * cs, RenderInfo * info) int active = false; int nAtIndex = obj->NAtom; const AtomInfoType *obj_AtomInfo = obj->AtomInfo.data(); - const AtomInfoType *ai, *last_ai = NULL; + const AtomInfoType *ai, *last_ai = nullptr; int trace, trace_ostate = SettingGet_i(G, cs->Setting.get(), obj->Setting.get(), cSetting_ribbon_trace_atoms); int trace_mode = diff --git a/layer2/RepSphere.cpp b/layer2/RepSphere.cpp index 51dbdc21c..2fa55a7b6 100644 --- a/layer2/RepSphere.cpp +++ b/layer2/RepSphere.cpp @@ -104,9 +104,9 @@ static int RepSphereRenderRay(PyMOLGlobals *G, RepSphere * I, RenderInfo * info) alpha = 1.0F; ray->transparentf(1.0 - alpha); if (I->spheroidCGO){ - CGORenderRay(I->spheroidCGO, ray, info, NULL, NULL, I->cs->Setting.get(), I->obj->Setting.get()); + CGORenderRay(I->spheroidCGO, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->obj->Setting.get()); } else { - CGORenderRay(I->primitiveCGO, ray, info, NULL, NULL, I->cs->Setting.get(), I->obj->Setting.get()); + CGORenderRay(I->primitiveCGO, ray, info, nullptr, nullptr, I->cs->Setting.get(), I->obj->Setting.get()); } ray->transparentf(0.0); return true; @@ -167,7 +167,7 @@ void RepSphere::render(RenderInfo* info) RepSphereRenderPick(I, info, sphere_mode); } else { /* not pick, render! */ if (I->spheroidCGO) { - CGORender(I->spheroidCGO, NULL, NULL, NULL, info, I); + CGORender(I->spheroidCGO, nullptr, nullptr, nullptr, info, I); return; } @@ -176,7 +176,7 @@ void RepSphere::render(RenderInfo* info) CGOFree(I->renderCGO); I->renderCGO = 0; } else { - CGORender(I->renderCGO, NULL, NULL, NULL, info, I); + CGORender(I->renderCGO, nullptr, nullptr, nullptr, info, I); return; } } @@ -204,7 +204,7 @@ void RepSphere::render(RenderInfo* info) } if (I->renderCGO) - CGORender(I->renderCGO, NULL, NULL, NULL, info, I); + CGORender(I->renderCGO, nullptr, nullptr, nullptr, info, I); } } } @@ -481,19 +481,19 @@ Rep *RepSphereNew(CoordSet * cs, int state) int ribbon_side_chain_helper = 0; AtomInfoType *ati1; int sphere_mode = 0; - bool *marked = NULL; + bool *marked = nullptr; float transp; int variable_alpha = false; short use_shader = SettingGetGlobal_b(G, cSetting_sphere_use_shader) && SettingGetGlobal_b(G, cSetting_use_shaders); // skip if not visible if(!cs->hasRep(cRepSphereBit)) - return NULL; + return nullptr; obj = cs->Obj; marked = pymol::calloc(obj->NAtom); if (!marked) - return NULL; + return nullptr; auto I = new RepSphere(cs, state); if (!cs->Spheroid.empty()) @@ -541,7 +541,7 @@ Rep *RepSphereNew(CoordSet * cs, int state) } ok &= !G->Interrupt; } - MapType *map = MapNew(G, SPHERE_NORMAL_RANGE, v_tmp, nspheres, NULL); + MapType *map = MapNew(G, SPHERE_NORMAL_RANGE, v_tmp, nspheres, nullptr); float cut_mult = SphereComputeCutMultiplier(G->Sphere->Sphere[1]); float *dot = G->Sphere->Sphere[1]->dot[0]; int n_dot = G->Sphere->Sphere[1]->nDot; @@ -611,7 +611,7 @@ Rep *RepSphereNew(CoordSet * cs, int state) FreeP(marked); if(nspheres == 0 || !ok) { delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/RepSphereGenerate.cpp b/layer2/RepSphereGenerate.cpp index 189d6d98a..e4c376f97 100644 --- a/layer2/RepSphereGenerate.cpp +++ b/layer2/RepSphereGenerate.cpp @@ -57,7 +57,7 @@ void RepSphere_Generate_Triangles(PyMOLGlobals *G, RepSphere *I, void RepSphere_Generate_Impostor_Spheres(PyMOLGlobals *G, RepSphere *I, RenderInfo *info) { if (!I->renderCGO) { - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; convertcgo = CGOOptimizeSpheresToVBONonIndexed(I->primitiveCGO, 0, true); if (convertcgo) { I->renderCGO = convertcgo; diff --git a/layer2/RepSurface.cpp b/layer2/RepSurface.cpp index 5873489fa..e91013918 100644 --- a/layer2/RepSurface.cpp +++ b/layer2/RepSurface.cpp @@ -112,8 +112,8 @@ RepSurface::~RepSurface() auto I = this; VLAFreeP(I->V); VLAFreeP(I->VN); - setPickingCGO(I, NULL); - setShaderCGO(I, NULL); + setPickingCGO(I, nullptr); + setShaderCGO(I, nullptr); FreeP(I->VC); FreeP(I->VA); if (I->VAO){ @@ -201,7 +201,7 @@ static void immediate_draw_indexed_vertices_alpha( const float * vc, // colors const float * va, // alpha array - float alpha, // alpha value if va is NULL + float alpha, // alpha value if va is nullptr const float * vn, // normals const float * v, // vertices const int * indices, // indices @@ -288,7 +288,7 @@ static int RepSurfaceCGOGenerate(RepSurface * I, RenderInfo * info) int ok = true; float alpha; int t_mode; - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; auto* const cs = I->cs; auto* const obj = I->cs->Obj; @@ -578,9 +578,9 @@ static int RepSurfaceCGOGenerate(RepSurface * I, RenderInfo * info) if(t_mode) { - float **t_buf = NULL, **tb; - float *z_value = NULL, *zv; - int *ix = NULL; + float **t_buf = nullptr, **tb; + float *z_value = nullptr, *zv; + int *ix = nullptr; int n_tri = 0; float sum[3]; float matrix[16]; @@ -1368,13 +1368,13 @@ static int RepSurfaceCGOGenerate(RepSurface * I, RenderInfo * info) #endif } else { if (ok) - convertcgo = CGOOptimizeToVBONotIndexedWithReturnedData(I->shaderCGO, 0, false, NULL); + convertcgo = CGOOptimizeToVBONotIndexedWithReturnedData(I->shaderCGO, 0, false, nullptr); CHECKOK(ok, convertcgo); } if (ok) convertcgo->use_shader = true; { - CGO *tmpCGO = NULL; + CGO *tmpCGO = nullptr; tmpCGO = CGONew(G); CGOEnable(tmpCGO, GL_SURFACE_SHADER); //CGOEnable(tmpCGO, CGO_GL_LIGHTING); // do we need this? @@ -1401,11 +1401,11 @@ static int RepSurfaceCGOGenerate(RepSurface * I, RenderInfo * info) if (ok) ok &= CGODisable(I->shaderCGO, GL_SURFACE_SHADER); if (ok) ok &= CGOStop(I->shaderCGO); CGOFreeWithoutVBOs(convertcgo); - convertcgo = NULL; + convertcgo = nullptr; } } else { setShaderCGO(I, convertcgo); - convertcgo = NULL; + convertcgo = nullptr; } if (I->shaderCGO) { @@ -1656,7 +1656,7 @@ void RepSurface::render(RenderInfo* info) if (ok && I->shaderCGO) { const float *color = ColorGet(G, obj->Color); - CGORender(I->shaderCGO, color, NULL, NULL, info, I); + CGORender(I->shaderCGO, color, nullptr, nullptr, info, I); return; } @@ -1664,7 +1664,7 @@ void RepSurface::render(RenderInfo* info) " RepSurfaceCGOGenerate failed\n" ENDFB(G); } - setShaderCGO(I, NULL); + setShaderCGO(I, nullptr); #ifndef PURE_OPENGL_ES_2 bool two_sided_lighting = @@ -1684,7 +1684,7 @@ void RepSurface::render(RenderInfo* info) if(!normals){ SceneResetNormal(G, true); - vn = NULL; + vn = nullptr; } if(!lighting) @@ -1696,7 +1696,7 @@ void RepSurface::render(RenderInfo* info) glBegin(GL_POINTS); if(I->oneColorFlag) { glColor3fv(ColorGet(G, I->oneColor)); - vc = NULL; + vc = nullptr; } else { glColor3f(1.0, 0.0, 0.0); } @@ -1720,7 +1720,7 @@ void RepSurface::render(RenderInfo* info) if(!normals){ SceneResetNormal(G, true); - vn = NULL; + vn = nullptr; } if(!lighting) @@ -1732,7 +1732,7 @@ void RepSurface::render(RenderInfo* info) if(I->oneColorFlag) { glColor3fv(ColorGet(G, I->oneColor)); - vc = NULL; + vc = nullptr; } glBegin(GL_LINES); @@ -1763,9 +1763,9 @@ void RepSurface::render(RenderInfo* info) if(t_mode) { - float **t_buf = NULL, **tb; - float *z_value = NULL, *zv; - int *ix = NULL; + float **t_buf = nullptr, **tb; + float *z_value = nullptr, *zv; + int *ix = nullptr; int n_tri = 0; float sum[3]; float matrix[16]; @@ -2019,7 +2019,7 @@ void RepSurface::render(RenderInfo* info) float col[3]; ColorGetEncoded(G, I->oneColor, col); glColor4f(col[0], col[1], col[2], alpha); - vc = NULL; + vc = nullptr; } if(I->allVisibleFlag) { @@ -2045,7 +2045,7 @@ void RepSurface::render(RenderInfo* info) } else if (ok) { /* opaque */ if(I->oneColorFlag) { glColor3fv(ColorGet(G, I->oneColor)); - vc = NULL; + vc = nullptr; } if(I->allVisibleFlag) { @@ -2173,7 +2173,7 @@ Rep* RepSurface::recolor() auto const I = this; assert(cs == this->cs); - MapType *map = NULL, *ambient_occlusion_map = NULL; + MapType *map = nullptr, *ambient_occlusion_map = nullptr; int a, i0, i, j, c1; float *v0, *vc, *va; const float *c0; @@ -2192,7 +2192,7 @@ Rep* RepSurface::recolor() int cullByFlag = false; int surface_mode, ambient_occlusion_mode; int surface_color; - int *present = NULL; + int *present = nullptr; int *rc; int ramped_flag = false; @@ -2201,24 +2201,24 @@ Rep* RepSurface::recolor() float carve_cutoff; float carve_normal_cutoff; int carve_normal_flag; - const char *carve_selection = NULL; - float *carve_vla = NULL; - MapType *carve_map = NULL; + const char *carve_selection = nullptr; + float *carve_vla = nullptr; + MapType *carve_map = nullptr; int clear_state = 0; int clear_flag = false; float clear_cutoff; - const char *clear_selection = NULL; - float *clear_vla = NULL; + const char *clear_selection = nullptr; + float *clear_vla = nullptr; int state = getState(); float transp; int variable_alpha = false; - MapType *clear_map = NULL; + MapType *clear_map = nullptr; - AtomInfoType *ai2 = NULL, *ai1; + AtomInfoType *ai2 = nullptr, *ai1; obj = cs->Obj; ambient_occlusion_mode = SettingGet_i(G, cs->Setting.get(), obj->Setting.get(), cSetting_ambient_occlusion_mode); @@ -2327,7 +2327,7 @@ Rep* RepSurface::recolor() if(inclInvis) { float probe_radiusX2 = probe_radius * 2; map = - MapNewFlagged(G, 2 * I->max_vdw + probe_radius, cs->Coord, cs->NIndex, NULL, + MapNewFlagged(G, 2 * I->max_vdw + probe_radius, cs->Coord, cs->NIndex, nullptr, present); MapSetupExpress(map); /* add in nearby invisibles */ @@ -2355,7 +2355,7 @@ Rep* RepSurface::recolor() } } MapFree(map); - map = NULL; + map = nullptr; } /** @@ -2390,9 +2390,9 @@ Rep* RepSurface::recolor() start_time = UtilGetSeconds(G); if (vertex_map){ - ambient_occlusion_map = MapNewFlagged(G, map_cutoff, I->V, I->N, NULL, NULL); + ambient_occlusion_map = MapNewFlagged(G, map_cutoff, I->V, I->N, nullptr, nullptr); } else { - ambient_occlusion_map = MapNewFlagged(G, map_cutoff, cs->Coord, cs->NIndex, NULL, present); + ambient_occlusion_map = MapNewFlagged(G, map_cutoff, cs->Coord, cs->NIndex, nullptr, present); } MapSetupExpress(ambient_occlusion_map); @@ -2616,12 +2616,12 @@ Rep* RepSurface::recolor() cur_time = UtilGetSeconds(G); PRINTFB(G, FB_RepSurface, FB_Debugging) "RepSurfaceColor(): Ambient Occlusion computed #atoms=%d #vertices=%d time=%lf seconds\n", cs->NIndex, I->N, (cur_time-start_time) ENDFB(G); - ambient_occlusion_map = NULL; + ambient_occlusion_map = nullptr; }; // update_VAO /* now, assign colors to each point */ - map = MapNewFlagged(G, cutoff, cs->Coord, cs->NIndex, NULL, present); + map = MapNewFlagged(G, cutoff, cs->Coord, cs->NIndex, nullptr, present); if(map) { short color_smoothing = SettingGetGlobal_i(G, cSetting_surface_color_smoothing); float color_smoothing_threshold = SettingGetGlobal_f(G, cSetting_surface_color_smoothing_threshold); @@ -2633,10 +2633,10 @@ Rep* RepSurface::recolor() for(a = 0; ok && a < I->N; a++) { float at_transp = transp; - AtomInfoType *ai0 = NULL; + AtomInfoType *ai0 = nullptr; float minDist = FLT_MAX, minDist2 = FLT_MAX, distDiff = FLT_MAX; int pi = -1, catm = -1; /* variables for color smoothing */ - AtomInfoType *pai = NULL, *pai2 = NULL; /* variables for color smoothing */ + AtomInfoType *pai = nullptr, *pai2 = nullptr; /* variables for color smoothing */ c1 = 1; i0 = -1; v0 = I->V + 3 * a; @@ -2844,12 +2844,12 @@ Rep* RepSurface::recolor() */ if(G->HaveGUI) { - setShaderCGO(I, NULL); + setShaderCGO(I, nullptr); } if(I->VA && (!variable_alpha)) { FreeP(I->VA); - I->VA = NULL; + I->VA = nullptr; } if(carve_map) @@ -2912,19 +2912,19 @@ static void SurfaceJobPurgeResult(PyMOLGlobals * G, SurfaceJob * I) I->N = 0; I->NT = 0; VLAFreeP(I->V); - I->V = NULL; + I->V = nullptr; VLAFreeP(I->VN); - I->VN = NULL; + I->VN = nullptr; VLAFreeP(I->T); - I->T = NULL; + I->T = nullptr; VLAFreeP(I->S); - I->S = NULL; + I->S = nullptr; } #ifndef _PYMOL_NOPY OV_INLINE PyObject *SurfaceJobAtomInfoAsPyTuple(SurfaceJobAtomInfo * atom_info) { - PyObject *result = NULL; + PyObject *result = nullptr; if(atom_info) { ov_size size = 2 * VLAGetSize(atom_info) + 1; result = PyTuple_New(size); @@ -2944,7 +2944,7 @@ OV_INLINE PyObject *SurfaceJobAtomInfoAsPyTuple(SurfaceJobAtomInfo * atom_info) #if 0 OV_INLINE SurfaceJobAtomInfo *SurfaceJobAtomInfoVLAFromPyTuple(PyObject * tuple) { - SurfaceJobAtomInfo *result = NULL; + SurfaceJobAtomInfo *result = nullptr; if(tuple && PyTuple_Check(tuple)) { ov_size size = PyTuple_Size(tuple); if(size) { @@ -3075,7 +3075,7 @@ static int SurfaceJobEliminateCloseDotsType3orMore(PyMOLGlobals * G, dot_flag[a] = 1; } { - MapType *map = MapNew(G, point_sep + 0.05F, I->V, I->N, NULL); + MapType *map = MapNew(G, point_sep + 0.05F, I->V, I->N, nullptr); int a; float *v = I->V; float *vn = I->VN; @@ -3135,7 +3135,7 @@ static int SurfaceJobEliminateCloseDotsTypeLessThan3(PyMOLGlobals * G, int ok = true; int a; float point_sep = I->pointSep; - MapType *map = MapNew(G, -point_sep, I->V, I->N, NULL); + MapType *map = MapNew(G, -point_sep, I->V, I->N, nullptr); float *v = I->V; float *vn = I->VN; @@ -3288,7 +3288,7 @@ static int SurfaceJobEliminateTroublesomeVertices(PyMOLGlobals * G, SurfaceJob * trim_cutoff *= 1.5; } while(ok && repeat_flag) { - MapType *map = MapNew(G, neighborhood, I->V, I->N, NULL); + MapType *map = MapNew(G, neighborhood, I->V, I->N, nullptr); CHECKOK(ok, map); if (ok){ int a; @@ -3318,7 +3318,7 @@ static int SurfaceJobAtomProximityCleanupPass(PyMOLGlobals * G, SurfaceJob * I, SurfaceJobAtomInfo *I_atom_info = I->atomInfo; int n_index = VLAGetSize(I->atomInfo); MapType *map = - MapNewFlagged(G, I->maxVdw + probe_radius, I_coord, n_index, NULL, + MapNewFlagged(G, I->maxVdw + probe_radius, I_coord, n_index, nullptr, present_vla); int a; float *v; @@ -3439,9 +3439,9 @@ static int SurfaceJobRefineAddNewVertices(PyMOLGlobals * G, SurfaceJob * I){ map_cutoff = 2.9 * point_sep; } { - MapType *map = NULL; + MapType *map = nullptr; int a; - map = MapNew(G, map_cutoff, I->V, I->N, NULL); + map = MapNew(G, map_cutoff, I->V, I->N, nullptr); CHECKOK(ok, map); if (ok) ok &= MapSetupExpress(map); @@ -3600,15 +3600,15 @@ static int SurfaceJobRun(PyMOLGlobals * G, SurfaceJob * I) "Error-RepSurface: insufficient memory to calculate surface at this quality.\n" ENDFB(G); VLAFreeP(I->V); - I->V = NULL; + I->V = nullptr; VLAFreeP(I->VN); - I->VN = NULL; + I->VN = nullptr; ok = false; } else { - SolventDot *sol_dot = NULL; + SolventDot *sol_dot = nullptr; float *v = I->V; float *vn = I->VN; - MapType *carve_map = NULL; + MapType *carve_map = nullptr; float probe_radius = I->probeRadius; int circumscribe = I->circumscribe; int surface_type = I->surfaceType; @@ -3649,12 +3649,12 @@ static int SurfaceJobRun(PyMOLGlobals * G, SurfaceJob * I) } ok &= !G->Interrupt; if(ok) { - MapType *map, *solv_map = NULL; + MapType *map, *solv_map = nullptr; map = MapNewFlagged(G, I->maxVdw + probe_rad_more, - I->coord, VLAGetSize(I->coord) / 3, NULL, NULL); + I->coord, VLAGetSize(I->coord) / 3, nullptr, nullptr); CHECKOK(ok, map); if (ok) - solv_map = MapNew(G, probe_rad_less, sol_dot->dot, sol_dot->nDot, NULL); + solv_map = MapNew(G, probe_rad_less, sol_dot->dot, sol_dot->nDot, nullptr); CHECKOK(ok, solv_map); if(ok) { ok &= MapSetupExpress(solv_map); @@ -3743,7 +3743,7 @@ static int SurfaceJobRun(PyMOLGlobals * G, SurfaceJob * I) } } SolventDotFree(sol_dot); - sol_dot = NULL; + sol_dot = nullptr; ok &= !G->Interrupt; if(ok) { int refine, ref_count = 1; @@ -3797,7 +3797,7 @@ static int SurfaceJobRun(PyMOLGlobals * G, SurfaceJob * I) float cutoff = point_sep * 5.0F; if((cutoff > probe_radius) && (!I->surfaceSolvent)) cutoff = probe_radius; - I->T = TrianglePointsToSurface(G, I->V, I->VN, I->N, cutoff, &I->NT, &I->S, NULL, + I->T = TrianglePointsToSurface(G, I->V, I->VN, I->N, cutoff, &I->NT, &I->S, nullptr, I->cavityMode); CHECKOK(ok, I->T); PRINTFB(G, FB_RepSurface, FB_Blather) @@ -3903,7 +3903,7 @@ static int RepSurfacePrepareSurfaceJob(PyMOLGlobals * G, SurfaceJob *surf_job, surf_job->allVisibleFlag = I->allVisibleFlag; surf_job->atomInfo = *atom_info; - (*atom_info) = NULL; + (*atom_info) = nullptr; surf_job->nPresent = n_present; if(present_vla && optimize) { @@ -3935,7 +3935,7 @@ static int RepSurfacePrepareSurfaceJob(PyMOLGlobals * G, SurfaceJob *surf_job, CHECKOK(ok, surf_job->atomInfo); } else { surf_job->presentVla = present_vla; - present_vla = NULL; + present_vla = nullptr; surf_job->coord = VLAlloc(float, cs->NIndex * 3); CHECKOK(ok, surf_job->coord); if(ok) @@ -3980,12 +3980,12 @@ void RepSurfaceConvertSurfaceJobToPyObject(PyMOLGlobals *G, SurfaceJob *surf_job if(OV_OK(SurfaceJobResultFromTuple(G, surf_job, *output))) { *found = true; PXDecRef(*input); - *input = NULL; + *input = nullptr; PXDecRef(*entry); - *entry = NULL; + *entry = nullptr; } PXDecRef(*output); - *output = NULL; + *output = nullptr; } if(PyErr_Occurred()) PyErr_Print(); @@ -4143,16 +4143,16 @@ Rep *RepSurfaceNew(CoordSet * cs, int state) int optimize = SettingGet_i(G, cs->Setting.get(), obj->Setting.get(), cSetting_surface_optimize_subsets); int circumscribe = SettingGet_i(G, cs->Setting.get(), obj->Setting.get(), cSetting_surface_circumscribe); int sphere_idx = 0, solv_sph_idx = 0; - MapType *map = NULL; + MapType *map = nullptr; float point_sep; - int *present_vla = NULL; + int *present_vla = nullptr; int n_present = 0; int carve_state = 0; int carve_flag = false; float carve_cutoff; - const char *carve_selection = NULL; - float *carve_vla = NULL; - MapType *carve_map = NULL; + const char *carve_selection = nullptr; + float *carve_vla = nullptr; + MapType *carve_map = nullptr; bool smooth_edges = SettingGet_b(G, cs->Setting.get(), obj->Setting.get(), cSetting_surface_smooth_edges); I->Type = surface_type; @@ -4241,7 +4241,7 @@ Rep *RepSurfaceNew(CoordSet * cs, int state) if (ok) map = - MapNewFlagged(G, 2 * I->max_vdw + probe_radius, cs->Coord, cs->NIndex, NULL, + MapNewFlagged(G, 2 * I->max_vdw + probe_radius, cs->Coord, cs->NIndex, nullptr, present_vla); CHECKOK(ok, map); if (ok) @@ -4257,7 +4257,7 @@ Rep *RepSurfaceNew(CoordSet * cs, int state) ok &= RepSurfaceRemoveAtomsNotWithinCutoff(G, carve_map, carve_vla, cs, present_vla, carve_cutoff); } MapFree(map); - map = NULL; + map = nullptr; /* now count how many atoms we actually need to think about */ n_present = 0; @@ -4281,9 +4281,9 @@ Rep *RepSurfaceNew(CoordSet * cs, int state) if(ok) { int found = false; #ifndef _PYMOL_NOPY - PyObject *entry = NULL; - PyObject *output = NULL; - PyObject *input = NULL; + PyObject *entry = nullptr; + PyObject *output = nullptr; + PyObject *input = nullptr; int cache_mode = SettingGet_i(G, cs->Setting.get(), obj->Setting.get(), cSetting_cache_mode); RepSurfaceConvertSurfaceJobToPyObject(G, surf_job, cs, obj, &entry, &input, &output, &found); #endif @@ -4296,9 +4296,9 @@ Rep *RepSurfaceNew(CoordSet * cs, int state) int blocked = PAutoBlock(G); output = SurfaceJobResultAsTuple(G, surf_job); PCacheSet(G, entry, output); - PXDecRef(entry); entry = NULL; - PXDecRef(output); output = NULL; - PXDecRef(input); input = NULL; + PXDecRef(entry); entry = nullptr; + PXDecRef(output); output = nullptr; + PXDecRef(input); input = nullptr; PAutoUnblock(G, blocked); } #endif @@ -4318,15 +4318,15 @@ Rep *RepSurfaceNew(CoordSet * cs, int state) I->N = surf_job->N; surf_job->N = 0; I->V = surf_job->V; - surf_job->V = NULL; + surf_job->V = nullptr; I->VN = surf_job->VN; - surf_job->VN = NULL; + surf_job->VN = nullptr; I->NT = surf_job->NT; surf_job->NT = 0; I->T = surf_job->T; - surf_job->T = NULL; + surf_job->T = nullptr; I->S = surf_job->S; - surf_job->S = NULL; + surf_job->S = nullptr; } SurfaceJobPurgeResult(G, surf_job); SurfaceJobFree(G, surf_job); @@ -4349,7 +4349,7 @@ Rep *RepSurfaceNew(CoordSet * cs, int state) if(!ok) { delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } @@ -4499,7 +4499,7 @@ static int SolventDotGetDotsAroundVertexInSphere(PyMOLGlobals * G, SolventDot *I float *v0 = coord + 3 * a; int b, ok = true; float *v = dotPtr + (*nDot) * 3; - float *n = NULL; + float *n = nullptr; Vector3f *sp_dot = sp->dot; if (dotNormal){ n = dotNormal + (*nDot) * 3; @@ -4776,7 +4776,7 @@ static SolventDot *SolventDotNew(PyMOLGlobals * G, I->nDot = 0; if (ok) { int dotCnt = 0; - MapType *map = MapNewFlagged(G, max_vdw + probe_radius, coord, n_coord, NULL, present); + MapType *map = MapNewFlagged(G, max_vdw + probe_radius, coord, n_coord, nullptr, present); CHECKOK(ok, map); ok &= !G->Interrupt; if(map && ok) { @@ -4800,9 +4800,9 @@ static SolventDot *SolventDotNew(PyMOLGlobals * G, /* for each pair of proximal atoms, circumscribe a circle for their intersection */ if (ok) { - MapType *map2 = NULL; + MapType *map2 = nullptr; if(circumscribe && (!surface_solvent)){ - map2 = MapNewFlagged(G, 2 * (max_vdw + probe_radius), coord, n_coord, NULL, present); + map2 = MapNewFlagged(G, 2 * (max_vdw + probe_radius), coord, n_coord, nullptr, present); CHECKOK(ok, map2); } ok &= !G->Interrupt; @@ -4866,7 +4866,7 @@ static SolventDot *SolventDotNew(PyMOLGlobals * G, cavity_cutoff = cavity_radius - cavity_cutoff * probe_radius; } { - MapType *map = MapNewFlagged(G, max_vdw + cavity_radius, coord, n_coord, NULL, present); + MapType *map = MapNewFlagged(G, max_vdw + cavity_radius, coord, n_coord, nullptr, present); CHECKOK(ok, map); if(G->Interrupt) ok = false; @@ -4881,7 +4881,7 @@ static SolventDot *SolventDotNew(PyMOLGlobals * G, skip_flag = false; ok = SolventDotFilterOutSameXYZ(G, map, atom_info, a_atom_info, coord, a, present, &skip_flag); if(ok && !skip_flag) { - ok = SolventDotGetDotsAroundVertexInSphere(G, I, map, atom_info, a_atom_info, coord, a, present, sp, cavity_radius, &dotCnt, stopDot, cavityDot, NULL, &nCavityDot); + ok = SolventDotGetDotsAroundVertexInSphere(G, I, map, atom_info, a_atom_info, coord, a, present, sp, cavity_radius, &dotCnt, stopDot, cavityDot, nullptr, &nCavityDot); } } a_atom_info++; @@ -4894,7 +4894,7 @@ static SolventDot *SolventDotNew(PyMOLGlobals * G, int *dot_flag = pymol::calloc(I->nDot); ErrChkPtr(G, dot_flag); { - MapType *map = MapNew(G, cavity_cutoff, cavityDot, nCavityDot, NULL); + MapType *map = MapNew(G, cavity_cutoff, cavityDot, nCavityDot, nullptr); if(map) { MapSetupExpress(map); ok = SolventDotMarkDotsWithinCutoff(G, I, map, I->dot, I->nDot, cavityDot, dot_flag, cavity_cutoff); @@ -4916,7 +4916,7 @@ static SolventDot *SolventDotNew(PyMOLGlobals * G, ErrChkPtr(G, dot_flag); { - MapType *map = MapNew(G, probe_radius_plus, I->dot, I->nDot, NULL); + MapType *map = MapNew(G, probe_radius_plus, I->dot, I->nDot, nullptr); if(map) { int flag = true; MapSetupExpress(map); @@ -4936,7 +4936,7 @@ static SolventDot *SolventDotNew(PyMOLGlobals * G, } if(!ok) { SolventDotFree(I); - I = NULL; + I = nullptr; } return I; } diff --git a/layer2/RepWireBond.cpp b/layer2/RepWireBond.cpp index 9de0c2fe1..aab9eb994 100644 --- a/layer2/RepWireBond.cpp +++ b/layer2/RepWireBond.cpp @@ -108,7 +108,7 @@ static void RepValence(CGO *cgo, bool s1, bool s2, bool isRamped, copy3f(p0, d); normalize3f(p0); /* need a prioritized third atom to get planarity */ - a3 = ObjectMoleculeGetPrioritizedOther(other, a1, a2, NULL); + a3 = ObjectMoleculeGetPrioritizedOther(other, a1, a2, nullptr); if(a3 < 0) { t[0] = p0[0]; t[1] = p0[1]; @@ -361,7 +361,7 @@ void RepWireBondRenderImmediate(CoordSet * cs, RenderInfo * info) static int RepWireBondCGOGenerate(RepWireBond * I, RenderInfo * info) { PyMOLGlobals *G = I->G; - CGO *convertcgo = NULL; + CGO *convertcgo = nullptr; int ok = true; short line_as_cylinders = 0; line_as_cylinders = SettingGetGlobal_b(G, cSetting_use_shaders) && SettingGetGlobal_b(G, cSetting_render_as_cylinders) && SettingGetGlobal_b(G, cSetting_line_as_cylinders); @@ -419,14 +419,14 @@ void RepWireBond::render(RenderInfo* info) if(ray) { #ifndef _PYMOL_NO_RAY - CGORenderRay(primitiveCGO, ray, info, NULL, NULL, cs->Setting.get(), cs->Obj->Setting.get()); + CGORenderRay(primitiveCGO, ray, info, nullptr, nullptr, cs->Setting.get(), cs->Obj->Setting.get()); ray->transparentf(0.0); #endif } else if(G->HaveGUI && G->ValidContext) { bool use_shader = SettingGetGlobal_b(G, cSetting_line_use_shader) && SettingGetGlobal_b(G, cSetting_use_shaders); if(pick) { - CGORenderPicking(use_shader ? I->shaderCGO : I->primitiveCGO, info, &I->context, NULL, NULL, I); + CGORenderPicking(use_shader ? I->shaderCGO : I->primitiveCGO, info, &I->context, nullptr, nullptr, I); } else { /* else not pick i.e., when rendering */ short line_as_cylinders ; line_as_cylinders = SettingGetGlobal_b(G, cSetting_render_as_cylinders) && SettingGetGlobal_b(G, cSetting_line_as_cylinders); @@ -438,9 +438,9 @@ void RepWireBond::render(RenderInfo* info) if (use_shader) { if (!I->shaderCGO) ok &= RepWireBondCGOGenerate(I, info); - CGORender(I->shaderCGO, NULL, NULL, NULL, info, I); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, info, I); } else { - CGORender(I->primitiveCGO, NULL, NULL, NULL, info, I); + CGORender(I->primitiveCGO, nullptr, nullptr, nullptr, info, I); } } } @@ -580,7 +580,7 @@ Rep *RepWireBondNew(CoordSet * cs, int state) int a, c1, c2, ord; bool s1, s2; const BondType *b; - int half_bonds, *other = NULL; + int half_bonds, *other = nullptr; float valence; const float *v1, *v2; int visFlag; @@ -591,7 +591,7 @@ Rep *RepWireBondNew(CoordSet * cs, int state) int ribbon_side_chain_helper = 0; int line_stick_helper = 0; int na_mode; - bool *marked = NULL; + bool *marked = nullptr; int valence_found = false; int variable_width = false; float last_line_width = -1.f; @@ -860,7 +860,7 @@ Rep *RepWireBondNew(CoordSet * cs, int state) FreeP(other); if (!ok || !line_counter){ delete I; - I = NULL; + I = nullptr; } return (Rep *) I; } diff --git a/layer2/Sculpt.cpp b/layer2/Sculpt.cpp index 4ee4b2d79..ebf302003 100644 --- a/layer2/Sculpt.cpp +++ b/layer2/Sculpt.cpp @@ -385,10 +385,10 @@ void SculptMeasureObject(CSculpt * I, ObjectMolecule * obj, int state, int match float *v0, *v1, *v2, *v3, d, dummy; CoordSet *cs; int n0, n1, n2, n3; - int *planar = NULL; - int *linear = NULL; - int *single = NULL; - int *crdidx = NULL; + int *planar = nullptr; + int *linear = nullptr; + int *single = nullptr; + int *crdidx = nullptr; int nex = 1; int *j, *k, xhash; int ex_type; @@ -646,7 +646,7 @@ void SculptMeasureObject(CSculpt * I, ObjectMolecule * obj, int state, int match atl.discCSet = obj->DiscreteCSet; } else { atl.atm2idx = cs->AtmToIdx.data(); - atl.discCSet = NULL; + atl.discCSet = nullptr; } atl.coord = cs->Coord; atl.neighbor = neighbor; @@ -1612,11 +1612,11 @@ float SculptIterateObject(CSculpt * I, ObjectMolecule * obj, CShaker *shk; int a0, a1, a2, a3, b0, b3; int aa; - float *disp = NULL; + float *disp = nullptr; float *v, *v0, *v1, *v2, *v3; float diff[3], len; - int *atm2idx = NULL; - int *cnt = NULL; + int *atm2idx = nullptr; + int *cnt = nullptr; int *i; int hash; int nb_next; @@ -1648,7 +1648,7 @@ float SculptIterateObject(CSculpt * I, ObjectMolecule * obj, int nb_skip, nb_skip_count; float total_strain = 0.0F, strain; int total_count = 1; - CGO *cgo = NULL; + CGO *cgo = nullptr; float good_color[3] = { 0.2, 1.0, 0.2 }; float bad_color[3] = { 1.0, 0.2, 0.2 }; int vdw_vis_mode; diff --git a/layer2/VFont.cpp b/layer2/VFont.cpp index ec5f26ac5..e33b0f9f2 100644 --- a/layer2/VFont.cpp +++ b/layer2/VFont.cpp @@ -58,7 +58,7 @@ int VFontWriteToCGO(PyMOLGlobals * G, int font_id, CGO * cgo, const char *text, float *pos, float *scale, float *matrix, float *color) { CVFont *I = G->VFont; - VFontRec *fr = NULL; + VFontRec *fr = nullptr; int ok = true; float base[3], pen[3]; float *pc; @@ -141,7 +141,7 @@ int VFontIndent(PyMOLGlobals * G, int font_id, const char *text, float *pos, flo float *matrix, float dir) { CVFont *I = G->VFont; - VFontRec *fr = NULL; + VFontRec *fr = nullptr; int ok = true; float pen[3]; unsigned char c; @@ -183,7 +183,7 @@ static int VFontRecLoad(PyMOLGlobals * G, VFontRec * I, PyObject * dict) ov_diff used = 0; int ok = true; PyObject *key, *char_list; - PyObject *stroke_list = NULL; + PyObject *stroke_list = nullptr; Py_ssize_t pos = 0; unsigned char code[2]; float adv; @@ -195,7 +195,7 @@ static int VFontRecLoad(PyMOLGlobals * G, VFontRec * I, PyObject * dict) ok = false; } else { if(ok) - ok = (char_list != NULL); + ok = (char_list != nullptr); if(ok) ok = PyList_Check(char_list); if(ok) @@ -205,7 +205,7 @@ static int VFontRecLoad(PyMOLGlobals * G, VFontRec * I, PyObject * dict) if(ok) { stroke_list = PyList_GetItem(char_list, 1); if(ok) - ok = (stroke_list != NULL); + ok = (stroke_list != nullptr); if(ok) ok = PyList_Check(stroke_list); if(ok) { @@ -267,7 +267,7 @@ static void VFontRecFree(PyMOLGlobals * G, VFontRec * I) int VFontInit(PyMOLGlobals * G) { - CVFont *I = NULL; + CVFont *I = nullptr; if((I = (G->VFont = pymol::calloc(1)))) { CVFont *I = G->VFont; @@ -297,7 +297,7 @@ int VFontLoad(PyMOLGlobals * G, float size, int face, int style, int can_load_ne int a; int result = 0; #ifndef _PYMOL_NOPY - PyObject *vfont = NULL; + PyObject *vfont = nullptr; #endif PRINTFD(G, FB_VFont) diff --git a/layer3/Editor.cpp b/layer3/Editor.cpp index 3bc3c48fe..46e22a2cf 100644 --- a/layer3/Editor.cpp +++ b/layer3/Editor.cpp @@ -312,7 +312,7 @@ static int EditorGetEffectiveState(PyMOLGlobals * G, pymol::CObject * obj, int s if(objMol) { if((objMol->NCSet == 1) && (state > 0)) - if(SettingGet_i(G, NULL, objMol->Setting.get(), cSetting_static_singletons)) + if(SettingGet_i(G, nullptr, objMol->Setting.get(), cSetting_static_singletons)) return 0; } } @@ -335,11 +335,11 @@ void EditorDefineExtraPks(PyMOLGlobals * G) if(EditorGetSinglePicked(G, name)) { sprintf(buffer, "(byres %s)", name); - SelectorCreate(G, cEditorRes, buffer, NULL, true, NULL); + SelectorCreate(G, cEditorRes, buffer, nullptr, true, nullptr); sprintf(buffer, "(bychain %s)", name); - SelectorCreate(G, cEditorChain, buffer, NULL, true, NULL); + SelectorCreate(G, cEditorChain, buffer, nullptr, true, nullptr); sprintf(buffer, "(byobject %s)", name); - SelectorCreate(G, cEditorObject, buffer, NULL, true, NULL); + SelectorCreate(G, cEditorObject, buffer, nullptr, true, nullptr); if(SettingGetGlobal_b(G, cSetting_auto_hide_selections)) ExecutiveHideSelections(G); @@ -392,7 +392,7 @@ int EditorIsBondMode(PyMOLGlobals * G) PyObject *EditorAsPyList(PyMOLGlobals * G) { - PyObject *result = NULL; + PyObject *result = nullptr; CEditor *I = G->Editor; if(!EditorActive(G)) { @@ -416,7 +416,7 @@ int EditorFromPyList(PyMOLGlobals * G, PyObject * list) int bond_mode = true; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -543,7 +543,7 @@ int EditorLogState(PyMOLGlobals * G, int pkresi) PLog(G, "edit", cPLog_pml); } else { int sele1, sele2, sele3, sele4; - ObjectMolecule *obj1 = NULL, *obj2 = NULL, *obj3 = NULL, *obj4 = NULL; + ObjectMolecule *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr, *obj4 = nullptr; int index1, index2, index3, index4; sele1 = SelectorIndexByName(G, cEditorSele1); @@ -657,7 +657,7 @@ EditorInvert(PyMOLGlobals * G, int quiet) (!ObjectMoleculeIsAtomBondedToSele(obj0, ia0, sele2)) && (!ObjectMoleculeIsAtomBondedToSele(obj0, ia1, sele2))) { found = true; - ObjectMoleculeTransformSelection(obj0, state, sele2, m, false, NULL, false, + ObjectMoleculeTransformSelection(obj0, state, sele2, m, false, nullptr, false, false); } } @@ -673,7 +673,7 @@ EditorInvert(PyMOLGlobals * G, int quiet) SceneInvalidate(G); I->DragIndex = -1; I->DragSelection = -1; - I->DragObject = NULL; + I->DragObject = nullptr; } } } @@ -695,7 +695,7 @@ pymol::Result<> EditorTorsion(PyMOLGlobals * G, float angle) int vf1, vf2; int ok = false; WordType sele; - ObjectMolecule *obj0 = NULL, *obj1 = NULL, *obj2 = NULL; + ObjectMolecule *obj0 = nullptr, *obj1 = nullptr, *obj2 = nullptr; if(!EditorActive(G)) { ErrMessage(G, "Editor", "Must specify a bond first."); @@ -735,16 +735,16 @@ pymol::Result<> EditorTorsion(PyMOLGlobals * G, float angle) theta = (float) (cPI * angle / 180.0); get_rotation_about3f3fTTTf(theta, n0, v1, m); ok = - ObjectMoleculeTransformSelection(obj2, state, sele2, m, false, NULL, false, + ObjectMoleculeTransformSelection(obj2, state, sele2, m, false, nullptr, false, false); SceneInvalidate(G); I->DragIndex = -1; I->DragSelection = -1; - I->DragObject = NULL; + I->DragObject = nullptr; if(I->BondMode && SettingGetGlobal_b(G, cSetting_editor_auto_dihedral)) - EditorDihedralInvalid(G, NULL); + EditorDihedralInvalid(G, nullptr); } } } @@ -777,20 +777,20 @@ pymol::Result<> EditorSelect(PyMOLGlobals* G, const char* str0, int i3 = -1; int result = false; int ok = true; - ObjectMolecule *obj0 = NULL, *obj1 = NULL, *obj2 = NULL, *obj3 = NULL; + ObjectMolecule *obj0 = nullptr, *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr; if(s0) if(!*s0) - s0 = NULL; + s0 = nullptr; if(s1) if(!*s1) - s1 = NULL; + s1 = nullptr; if(s2) if(!*s2) - s2 = NULL; + s2 = nullptr; if(s3) if(!*s3) - s3 = NULL; + s3 = nullptr; if(s0) { obj0 = SelectorGetFastSingleAtomObjectIndex(G, tmp0.getIndex(), &i0); @@ -826,13 +826,13 @@ pymol::Result<> EditorSelect(PyMOLGlobals* G, const char* str0, ObjectMoleculeVerifyChemistry(obj3, -1); if(i0 >= 0) - SelectorCreate(G, cEditorSele1, s0, NULL, quiet, NULL); + SelectorCreate(G, cEditorSele1, s0, nullptr, quiet, nullptr); if(i1 >= 0) - SelectorCreate(G, cEditorSele2, s1, NULL, quiet, NULL); + SelectorCreate(G, cEditorSele2, s1, nullptr, quiet, nullptr); if(i2 >= 0) - SelectorCreate(G, cEditorSele3, s2, NULL, quiet, NULL); + SelectorCreate(G, cEditorSele3, s2, nullptr, quiet, nullptr); if(i3 >= 0) - SelectorCreate(G, cEditorSele4, s3, NULL, quiet, NULL); + SelectorCreate(G, cEditorSele4, s3, nullptr, quiet, nullptr); EditorActivate(G, SceneGetState(G), pkbond); @@ -1003,7 +1003,7 @@ pymol::Result<> EditorRemove(PyMOLGlobals * G, int hydrogen, int quiet) if(hydrogen) { auto buf = pymol::string_format("((neighbor %s) and hydro)", cEditorSele1); - h_flag = SelectorCreate(G, cEditorRemoveSele, buf.c_str(), NULL, false, NULL).result(); + h_flag = SelectorCreate(G, cEditorRemoveSele, buf.c_str(), nullptr, false, nullptr).result(); } if(SelectorGetFastSingleAtomObjectIndex(G, sele0, &i0)) { @@ -1016,7 +1016,7 @@ pymol::Result<> EditorRemove(PyMOLGlobals * G, int hydrogen, int quiet) if(hydrogen) { auto buf = pymol::string_format("((neighbor %s) and hydro)", cEditorSet); - h_flag = SelectorCreate(G, cEditorRemoveSele, buf.c_str(), NULL, false, NULL).result(); + h_flag = SelectorCreate(G, cEditorRemoveSele, buf.c_str(), nullptr, false, nullptr).result(); } ExecutiveRemoveAtoms(G, cEditorSet, quiet); } @@ -1037,7 +1037,7 @@ pymol::Result<> EditorHFill(PyMOLGlobals * G, int quiet) { int sele0, sele1; int i0; - ObjectMolecule *obj0 = NULL, *obj1 = NULL; + ObjectMolecule *obj0 = nullptr, *obj1 = nullptr; if(EditorActive(G)) { sele0 = SelectorIndexByName(G, cEditorSele1); @@ -1114,7 +1114,7 @@ pymol::Result<> EditorReplace(PyMOLGlobals* G, const char* elem, int geom, int i0; int sele0; AtomInfoType ai; - ObjectMolecule *obj0 = NULL; + ObjectMolecule *obj0 = nullptr; int ok = true; UtilZeroMem(&ai, sizeof(AtomInfoType)); if(EditorActive(G)) { @@ -1585,10 +1585,10 @@ void EditorRender(PyMOLGlobals * G, int state) float v0[3], v1[3]; float vp[12], *vv; /* int v_cnt; */ - ObjectMolecule *obj1 = NULL, *obj2 = NULL, *obj3 = NULL, *obj4 = NULL; + ObjectMolecule *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr, *obj4 = nullptr; int index1, index2, index3, index4; int st, frozen; - CGO *shaderCGO = NULL; + CGO *shaderCGO = nullptr; if(EditorActive(G)) { int use_shader = SettingGetGlobal_b(G, cSetting_use_shaders); @@ -1596,7 +1596,7 @@ void EditorRender(PyMOLGlobals * G, int state) if (!I->shaderCGO){ shaderCGO = CGONew(G); } else { - CGORender(I->shaderCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, nullptr, nullptr); return; } } else { @@ -1692,7 +1692,7 @@ void EditorRender(PyMOLGlobals * G, int state) } CGOFree(shaderCGO); if (ok){ - CGORender(I->shaderCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(I->shaderCGO, nullptr, nullptr, nullptr, nullptr, nullptr); } } } @@ -1712,8 +1712,8 @@ void EditorInactivate(PyMOLGlobals * G) OrthoInvalidateDoDraw(G); } - I->DihedObject = NULL; - I->DragObject = NULL; + I->DihedObject = nullptr; + I->DragObject = nullptr; I->BondMode = false; I->ShowFrags = false; I->NFrag = 0; @@ -1802,7 +1802,7 @@ void EditorActivate(PyMOLGlobals * G, int state, int enable_bond) sele3, sele4, cEditorBasePref, cEditorComp, &I->BondMode); /* just returns 'state' */ - state = EditorGetEffectiveState(G, NULL, state); + state = EditorGetEffectiveState(G, nullptr, state); I->ActiveState = state; I->ShowFrags = false; @@ -1810,7 +1810,7 @@ void EditorActivate(PyMOLGlobals * G, int state, int enable_bond) ExecutiveHideSelections(G); if(I->BondMode && SettingGetGlobal_b(G, cSetting_editor_auto_dihedral)) - EditorDihedralInvalid(G, NULL); + EditorDihedralInvalid(G, nullptr); if (!I->BondMode && SettingGetGlobal_b(G, cSetting_editor_auto_measure)) EditorAutoMeasure(G, sele1, sele2, sele3, sele4, state); @@ -1830,7 +1830,7 @@ void EditorSetDrag(PyMOLGlobals * G, pymol::CObject * obj, int sele, int quiet, if(obj->type == cObjectMolecule) { ObjectMolecule *objMol = (ObjectMolecule*)(void*)obj; if(ObjectMoleculeCheckFullStateSelection(objMol, sele, state)) { - int matrix_mode = SettingGet_i(G, obj->Setting.get(), NULL, cSetting_matrix_mode); + int matrix_mode = SettingGet_i(G, obj->Setting.get(), nullptr, cSetting_matrix_mode); if(matrix_mode>=1) { /* force / coerce object matrix drags? */ sele = -1; @@ -1862,7 +1862,7 @@ void EditorPrepareDrag(PyMOLGlobals * G, pymol::CObject * obj, CEditor *I = G->Editor; int log_trans = SettingGetGlobal_b(G, cSetting_log_conformations); int drag_sele = -1; - ObjectMolecule *objMol = NULL; + ObjectMolecule *objMol = nullptr; PRINTFD(G, FB_Editor) " EditorPrepareDrag-Debug: entered. obj %p index %d\n", (void *) obj, index ENDFD; @@ -2103,7 +2103,7 @@ void EditorPrepareDrag(PyMOLGlobals * G, pymol::CObject * obj, if(!seleFlag) { I->DragIndex = -1; I->DragSelection = -1; - I->DragObject = NULL; + I->DragObject = nullptr; } } if(I->DragObject) { @@ -2155,7 +2155,7 @@ void EditorDrag(PyMOLGlobals * G, pymol::CObject * obj, int index, int mode, int obj = I->DragObject; if(obj) { - ObjectMolecule *objMol = NULL; + ObjectMolecule *objMol = nullptr; if(obj->type == cObjectMolecule) objMol = (ObjectMolecule*)(void*)obj; @@ -2164,7 +2164,7 @@ void EditorDrag(PyMOLGlobals * G, pymol::CObject * obj, int index, int mode, int if((index == I->DragIndex) && (obj == I->DragObject)) { if(!EditorActive(G)) { int matrix_mode = SettingGet_i(G, I->DragObject->Setting.get(), - NULL, cSetting_matrix_mode); + nullptr, cSetting_matrix_mode); if(matrix_mode<0) matrix_mode = EditorDraggingObjectMatrix(G) ? 1 : 0; @@ -2350,7 +2350,7 @@ void EditorDrag(PyMOLGlobals * G, pymol::CObject * obj, int index, int mode, int log_trans, I->DragSeleName, false, true); } else { - if(z_dir) { /* NULL-safety */ + if(z_dir) { /* nullptr-safety */ cross_product3f(I->Axis, z_dir, d0); theta = -dot_product3f(d0, mov); get_rotation_about3f3fTTTf(theta, n0, v1, m); @@ -2361,7 +2361,7 @@ void EditorDrag(PyMOLGlobals * G, pymol::CObject * obj, int index, int mode, int } if(I->BondMode && SettingGetGlobal_b(G, cSetting_editor_auto_dihedral)) - EditorDihedralInvalid(G, NULL); + EditorDihedralInvalid(G, nullptr); } SceneInvalidate(G); @@ -2410,13 +2410,13 @@ void EditorRemoveStale(PyMOLGlobals* G) /*========================================================================*/ int EditorInit(PyMOLGlobals * G) { - CEditor *I = NULL; + CEditor *I = nullptr; if((I = (G->Editor = pymol::calloc(1)))) { - I->DihedObject = NULL; + I->DihedObject = nullptr; I->NFrag = 0; I->Active = false; - I->DragObject = NULL; + I->DragObject = nullptr; I->DragIndex = -1; I->DragSelection = -1; I->NextPickSele = 0; @@ -2425,7 +2425,7 @@ int EditorInit(PyMOLGlobals * G) I->DihedralInvalid = false; I->MouseInvalid = false; I->FavorOrigin = false; - I->shaderCGO = NULL; + I->shaderCGO = nullptr; return 1; } else return 0; diff --git a/layer3/Executive.cpp b/layer3/Executive.cpp index 22d0d4e93..c36affd58 100644 --- a/layer3/Executive.cpp +++ b/layer3/Executive.cpp @@ -256,7 +256,7 @@ pymol::CObject * ObjectIterator::getObject() { * Find object of given type, or delete object if it exists but has the wrong * type. * @param name Object name - * @return NULL if object can't be found or has the wrong type + * @return nullptr if object can't be found or has the wrong type */ template ObjectT* ExecutiveFindOrDeleteObject(PyMOLGlobals* G, pymol::zstring_view name) @@ -427,16 +427,16 @@ int ExecutiveMotionView(PyMOLGlobals *G, int action, int first, if(name && name[0] && strcmp(name, cKeywordNone)) { /* also do all other objects */ - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { switch(rec->type) { case cExecObject: if(autogen) { - power = SettingGet_f(G, NULL, rec->obj->Setting.get(), cSetting_motion_power); - bias = SettingGet_f(G, NULL, rec->obj->Setting.get(), cSetting_motion_bias); - simple = SettingGet_i(G, NULL, rec->obj->Setting.get(), cSetting_motion_simple); - linear = SettingGet_f(G, NULL, rec->obj->Setting.get(), cSetting_motion_linear); - hand = SettingGet_i(G, NULL, rec->obj->Setting.get(), cSetting_motion_hand); + power = SettingGet_f(G, nullptr, rec->obj->Setting.get(), cSetting_motion_power); + bias = SettingGet_f(G, nullptr, rec->obj->Setting.get(), cSetting_motion_bias); + simple = SettingGet_i(G, nullptr, rec->obj->Setting.get(), cSetting_motion_simple); + linear = SettingGet_f(G, nullptr, rec->obj->Setting.get(), cSetting_motion_linear); + hand = SettingGet_i(G, nullptr, rec->obj->Setting.get(), cSetting_motion_hand); } if((ObjectGetSpecLevel(rec->obj,0)>=0)||(!strcmp(name,cKeywordAll))) { ok = ObjectMotion(rec->obj, action, first, last, power, bias, @@ -449,7 +449,7 @@ int ExecutiveMotionView(PyMOLGlobals *G, int action, int first, } } else { /* pattern */ CTracker *I_Tracker = I->Tracker; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int list_id = ExecutiveGetNamesListFromPattern(G, name, true, true); int iter_id = TrackerNewIter(I_Tracker, 0, list_id); while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &rec)) { @@ -458,11 +458,11 @@ int ExecutiveMotionView(PyMOLGlobals *G, int action, int first, switch (rec->type) { case cExecObject: if(autogen) { - power = SettingGet_f(G, NULL, rec->obj->Setting.get(), cSetting_motion_power); - bias = SettingGet_f(G, NULL, rec->obj->Setting.get(), cSetting_motion_bias); - simple = SettingGet_i(G, NULL, rec->obj->Setting.get(), cSetting_motion_simple); - linear = SettingGet_f(G, NULL, rec->obj->Setting.get(), cSetting_motion_linear); - hand = SettingGet_i(G, NULL, rec->obj->Setting.get(), cSetting_motion_hand); + power = SettingGet_f(G, nullptr, rec->obj->Setting.get(), cSetting_motion_power); + bias = SettingGet_f(G, nullptr, rec->obj->Setting.get(), cSetting_motion_bias); + simple = SettingGet_i(G, nullptr, rec->obj->Setting.get(), cSetting_motion_simple); + linear = SettingGet_f(G, nullptr, rec->obj->Setting.get(), cSetting_motion_linear); + hand = SettingGet_i(G, nullptr, rec->obj->Setting.get(), cSetting_motion_hand); } ok = ObjectMotion(rec->obj, action, first, last, power, bias, @@ -496,7 +496,7 @@ pymol::Result<> ExecutiveMotionViewModify(PyMOLGlobals* G, int action, } if((!name) || strcmp(name, cKeywordNone)) { /* also do all other objects */ - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { switch(rec->type) { case cExecObject: @@ -516,7 +516,7 @@ pymol::Result<> ExecutiveMotionViewModify(PyMOLGlobals* G, int action, } } else { /* pattern */ CTracker *I_Tracker = I->Tracker; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int list_id = ExecutiveGetNamesListFromPattern(G, name, true, true); int iter_id = TrackerNewIter(I_Tracker, 0, list_id); while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &rec)) { @@ -541,7 +541,7 @@ pymol::Result<> ExecutiveMotionViewModify(PyMOLGlobals* G, int action, void ExecutiveMotionReinterpolate(PyMOLGlobals * G) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { switch(rec->type) { case cExecAll: @@ -562,7 +562,7 @@ void ExecutiveMotionTrim(PyMOLGlobals * G) { int n_frame = MovieGetLength(G); CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { switch(rec->type) { case cExecObject: @@ -579,7 +579,7 @@ void ExecutiveMotionExtend(PyMOLGlobals * G, int freeze) int n_frame = 0; int max_length = 0; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; if(MovieGetSpecLevel(G,-1)>0) n_frame = MovieGetLength(G); while(ListIterate(I->Spec, rec, next)) { @@ -617,7 +617,7 @@ int ExecutiveCountMotions(PyMOLGlobals * G) int count = 0; CExecutive *I = G->Executive; if(MovieGetLength(G)) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { switch(rec->type) { case cExecAll: @@ -648,7 +648,7 @@ int ExecutiveCountMotions(PyMOLGlobals * G) void ExecutiveMotionDraw(PyMOLGlobals * G, BlockRect *rect, int expected , CGO *orthoCGO) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int frames = MovieGetLength(G); BlockRect draw_rect = *rect; int count = 0; @@ -689,7 +689,7 @@ void ExecutiveMotionMenuActivate(PyMOLGlobals * G, BlockRect *rect, int expected int x, int y, int same) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; BlockRect draw_rect = *rect; int count = 0; int height = rect->top - rect->bottom; @@ -751,7 +751,7 @@ void ExecutiveMotionMenuActivate(PyMOLGlobals * G, BlockRect *rect, int expected void ExecutiveMotionClick(PyMOLGlobals * G, BlockRect *rect,int mode, int expected, int x, int y, int nearest) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; BlockRect draw_rect = *rect; int count = 0; int height = rect->top - rect->bottom; @@ -1006,10 +1006,10 @@ pymol::Result<> ExecutiveIsomeshEtc(PyMOLGlobals * G, ObjectMap *mapObj; float mn[3] = { 0, 0, 0 }; float mx[3] = { 15, 15, 15 }; - float *vert_vla = NULL; + float *vert_vla = nullptr; int multi = false; ObjectMapState *ms; - ObjectMolecule *sele_obj = NULL; + ObjectMolecule *sele_obj = nullptr; CSymmetry *symm; auto res0 = EtcHelper( @@ -1076,13 +1076,13 @@ pymol::Result<> ExecutiveIsomeshEtc(PyMOLGlobals * G, PRINTFB(G, FB_CCmd, FB_Blather) " Isomesh: buffer %8.3f carve %8.3f \n", fbuf, carve ENDFB(G); - symm = NULL; + symm = nullptr; if(sele_obj && ObjectMapValidXtal(mapObj, state)) { - if(SettingGet_b(G, NULL, sele_obj->Setting.get(), cSetting_map_auto_expand_sym) + if(SettingGet_b(G, nullptr, sele_obj->Setting.get(), cSetting_map_auto_expand_sym) && (sele_obj->Symmetry)) { // legacy default: take symmetry from molecular object symm = sele_obj->Symmetry.get(); - } else if(SettingGet_b(G, NULL, mapObj->Setting.get(), cSetting_map_auto_expand_sym)) { + } else if(SettingGet_b(G, nullptr, mapObj->Setting.get(), cSetting_map_auto_expand_sym)) { // fallback: take symmetry from map state symm = ms->Symmetry.get(); } @@ -1095,7 +1095,7 @@ pymol::Result<> ExecutiveIsomeshEtc(PyMOLGlobals * G, mesh_mode, carve, vert_vla, alt_lvl, quiet); } else { - obj = NULL; + obj = nullptr; } if(!obj) { obj = ObjectMeshFromBox(G, origObj, mapObj, @@ -1151,10 +1151,10 @@ ExecutiveVolume(PyMOLGlobals * G, const char *volume_name, const char *map_name, ObjectMap *mapObj; float mn[3] = { 0, 0, 0 }; float mx[3] = { 15, 15, 15 }; - float *vert_vla = NULL; + float *vert_vla = nullptr; int multi = false; ObjectMapState *ms; - ObjectMolecule *sele_obj = NULL; + ObjectMolecule *sele_obj = nullptr; CSymmetry *symm; /* Goal: make a new volume map from the object or selection @@ -1252,13 +1252,13 @@ ExecutiveVolume(PyMOLGlobals * G, const char *volume_name, const char *map_name, PRINTFB(G, FB_CCmd, FB_Blather) " Volume: buffer %8.3f carve %8.3f \n", fbuf, carve ENDFB(G); - symm = NULL; + symm = nullptr; if(sele_obj && ObjectMapValidXtal(mapObj, state)) { - if(SettingGet_b(G, NULL, sele_obj->Setting.get(), cSetting_map_auto_expand_sym) + if(SettingGet_b(G, nullptr, sele_obj->Setting.get(), cSetting_map_auto_expand_sym) && (sele_obj->Symmetry)) { // legacy default: take symmetry from molecular object symm = sele_obj->Symmetry.get(); - } else if(SettingGet_b(G, NULL, mapObj->Setting.get(), cSetting_map_auto_expand_sym)) { + } else if(SettingGet_b(G, nullptr, mapObj->Setting.get(), cSetting_map_auto_expand_sym)) { // fallback: take symmetry from map state symm = ms->Symmetry.get(); } @@ -1271,7 +1271,7 @@ ExecutiveVolume(PyMOLGlobals * G, const char *volume_name, const char *map_name, box_mode, carve, vert_vla, quiet); } else { - obj = NULL; + obj = nullptr; } if(!obj) { @@ -1388,7 +1388,7 @@ static void ExecutiveInvalidateGridSlots(PyMOLGlobals * G) static void ExecutiveSetGridSlot(SpecRec *rec, int new_grid_slot){ if (rec->grid_slot != new_grid_slot){ CGOFree(rec->gridSlotSelIndicatorsCGO); - rec->gridSlotSelIndicatorsCGO = NULL; + rec->gridSlotSelIndicatorsCGO = nullptr; rec->grid_slot = new_grid_slot; } } @@ -1403,7 +1403,7 @@ static void ExecutiveUpdateGridSlots(PyMOLGlobals * G, int force) CTracker *I_Tracker = I->Tracker; I->ValidGridSlots = true; { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { ExecutiveSetGridSlot(rec, 0); if(rec->type == cExecObject) { @@ -1428,7 +1428,7 @@ static void ExecutiveUpdateGridSlots(PyMOLGlobals * G, int force) } if(grid_by_group) { - SpecRec *rec = NULL, *group_rec = NULL; + SpecRec *rec = nullptr, *group_rec = nullptr; while(ListIterate(I->Spec, rec, next)) { OVreturn_word result; if(OVreturn_IS_OK @@ -1458,10 +1458,10 @@ static void ExecutiveUpdateGridSlots(PyMOLGlobals * G, int force) } { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { - int obj_slot = SettingGet_i(G, rec->obj->Setting.get(), NULL, cSetting_grid_slot); + int obj_slot = SettingGet_i(G, rec->obj->Setting.get(), nullptr, cSetting_grid_slot); if(obj_slot == -1) { rec->obj->grid_slot = rec->grid_slot; } else @@ -1542,7 +1542,7 @@ void ExecutiveUpdateSceneMembers(PyMOLGlobals * G) ExecutiveUpdateGroups(G, false); ExecutiveUpdateGridSlots(G, false); if(!I->ValidSceneMembers) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { int visible = rec->visible; @@ -1655,9 +1655,9 @@ static int ExecutiveGetObjectParentList(PyMOLGlobals * G, SpecRec * child) CTracker *I_Tracker = I->Tracker; int priority = 1; /* generations removed from child */ int repeat_flag = true; - SpecRec *group_rec = NULL; + SpecRec *group_rec = nullptr; - list_id = TrackerNewList(I_Tracker, NULL); + list_id = TrackerNewList(I_Tracker, nullptr); while(child && child->group && repeat_flag) { OVreturn_word result; repeat_flag = false; @@ -1745,8 +1745,8 @@ static int ExecutiveDelKey(CExecutive * I, SpecRec * rec) static SpecRec *ExecutiveUnambiguousNameMatch(PyMOLGlobals * G, const char *name) { CExecutive *I = G->Executive; - SpecRec *result = NULL; - SpecRec *rec = NULL; + SpecRec *result = nullptr; + SpecRec *rec = nullptr; int best = 0; int wm; int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); @@ -1761,7 +1761,7 @@ static SpecRec *ExecutiveUnambiguousNameMatch(PyMOLGlobals * G, const char *name result = rec; best = wm; } else if((wm > 0) && (best == wm)) { /* ambiguous match... no good */ - result = NULL; + result = nullptr; } } return (result); @@ -1770,8 +1770,8 @@ static SpecRec *ExecutiveUnambiguousNameMatch(PyMOLGlobals * G, const char *name static SpecRec *ExecutiveAnyCaseNameMatch(PyMOLGlobals * G, const char *name) { CExecutive *I = G->Executive; - SpecRec *result = NULL; - SpecRec *rec = NULL; + SpecRec *result = nullptr; + SpecRec *rec = nullptr; int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); while(ListIterate(I->Spec, rec, next)) { @@ -1795,7 +1795,7 @@ int ExecutiveScrollTo(PyMOLGlobals * G, const char * name, int i) { CExecutive *I = G->Executive; int pos = 0, numhits = 0; ObjectGroup *group; - SpecRec *tmp, *spec = NULL, *first = NULL; + SpecRec *tmp, *spec = nullptr, *first = nullptr; int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); int j, lendiff, plen = strlen(name); @@ -1855,7 +1855,7 @@ int ExecutiveScrollTo(PyMOLGlobals * G, const char * name, int i) { void ExecutiveUpdateColorDepends(PyMOLGlobals * G, ObjectMolecule * mol) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { @@ -1879,10 +1879,10 @@ void ExecutiveUpdateCoordDepends(PyMOLGlobals * G, ObjectMolecule * mol) { /* nasty, ugly, inefficient hack */ CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; ObjectGadget *gadget; int done_inv_all = false; - int dynamic_measures = SettingGet_b(G, mol ? mol->Setting.get() : NULL, NULL, + int dynamic_measures = SettingGet_b(G, mol ? mol->Setting.get() : nullptr, nullptr, cSetting_dynamic_measures); while(ListIterate(I->Spec, rec, next)) { @@ -2052,7 +2052,7 @@ int ExecutiveGetNamesListFromPattern(PyMOLGlobals * G, const char *name, if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) group_found = true; if(!result) - result = TrackerNewList(I_Tracker, NULL); + result = TrackerNewList(I_Tracker, nullptr); if(result) { TrackerLink(I_Tracker, cand_id, result, 1); } @@ -2063,12 +2063,12 @@ int ExecutiveGetNamesListFromPattern(PyMOLGlobals * G, const char *name, } else if((rec = ExecutiveFindSpec(G, name))) { /* only one name in list */ if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) group_found = true; - result = TrackerNewList(I_Tracker, NULL); + result = TrackerNewList(I_Tracker, nullptr); TrackerLink(I_Tracker, rec->cand_id, result, 1); } else if(allow_partial && (rec = ExecutiveUnambiguousNameMatch(G, name))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) group_found = true; - result = TrackerNewList(I_Tracker, NULL); + result = TrackerNewList(I_Tracker, nullptr); TrackerLink(I_Tracker, rec->cand_id, result, 1); } if(matcher) @@ -2104,7 +2104,7 @@ static void ExecutiveGroupPurge(PyMOLGlobals* G, SpecRec* rec, std::vector recs; auto ignore_case = SettingGet(G, cSetting_ignore_case); - SpecRec *rec2 = NULL; + SpecRec *rec2 = nullptr; while (ListIterate(G->Executive->Spec, rec2, next)) { if ((rec2->group == rec) || WordMatchExact(G, rec2->group_name, rec->name, ignore_case)) { @@ -2169,7 +2169,7 @@ int ExecutiveGroup(PyMOLGlobals * G, pymol::zstring_view nameView, while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &rec)) { if(rec) { - ObjectGroup *objGroup = NULL; + ObjectGroup *objGroup = nullptr; if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) { objGroup = (ObjectGroup *) rec->obj; } @@ -2189,11 +2189,11 @@ int ExecutiveGroup(PyMOLGlobals * G, pymol::zstring_view nameView, break; case cExecutiveGroupEmpty: if(objGroup) { - SpecRec *rec2 = NULL; + SpecRec *rec2 = nullptr; while(ListIterate(I->Spec, rec2, next)) { if((rec2->group == rec) || WordMatchExact(G, rec2->group_name, rec->name, ignore_case)) { - rec2->group = NULL; + rec2->group = nullptr; rec2->group_name[0] = 0; } } @@ -2209,7 +2209,7 @@ int ExecutiveGroup(PyMOLGlobals * G, pymol::zstring_view nameView, if(rec->group_name[0]) { /* cascade group members up to the surrounding group */ - SpecRec *rec2 = NULL; + SpecRec *rec2 = nullptr; while(ListIterate(I->Spec, rec2, next)) { if((rec2->group == rec) || WordMatch(G, rec->name, rec2->group_name, ignore_case)) { @@ -2219,7 +2219,7 @@ int ExecutiveGroup(PyMOLGlobals * G, pymol::zstring_view nameView, } } else if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) { /* and/or delete their group membership */ - SpecRec *rec2 = NULL; + SpecRec *rec2 = nullptr; while(ListIterate(I->Spec, rec2, next)) { if((rec2->group == rec) || WordMatch(G, rec->name, rec2->group_name, ignore_case)) { @@ -2328,7 +2328,7 @@ int ExecutiveDrawCmd(PyMOLGlobals * G, int width, int height, int antialias, ExecutiveSetSettingFromString(G, cSetting_draw_mode, "-2", "", -1, true, true); SceneUpdate(G, false); } - SceneDeferImage(G, width, height, NULL, antialias, -1.0, cMyPNG_FormatPNG, quiet, nullptr); + SceneDeferImage(G, width, height, nullptr, antialias, -1.0, cMyPNG_FormatPNG, quiet, nullptr); } return 1; } @@ -2360,7 +2360,7 @@ int ExecutiveMatrixCopy2(PyMOLGlobals * G, switch (source_mode) { case 0: /* txf history is the source matrix */ { - double *history = NULL; + double *history = nullptr; int found = ExecutiveGetObjectMatrix2(G, source_obj, source_state, &history, false); if(found) { switch (target_mode) { @@ -2368,7 +2368,7 @@ int ExecutiveMatrixCopy2(PyMOLGlobals * G, { double temp_inverse[16]; if(target_undo) { - double *target_history = NULL; + double *target_history = nullptr; int target_found = ExecutiveGetObjectMatrix2(G, source_obj, target_state, &target_history, @@ -2409,7 +2409,7 @@ int ExecutiveMatrixCopy2(PyMOLGlobals * G, convertR44dTTTf(history, tttf); ObjectSetTTT(target_obj, tttf, -1, -1); } else { - ObjectSetTTT(target_obj, NULL, -1, -1); + ObjectSetTTT(target_obj, nullptr, -1, -1); } target_obj->invalidate(cRepNone, cRepInvExtents, -1); break; @@ -2444,7 +2444,7 @@ int ExecutiveMatrixCopy2(PyMOLGlobals * G, convertTTTfR44d(tttf, homo); ok = ExecutiveSetObjectMatrix2(G, target_obj, -1, homo); } else { - ok = ExecutiveSetObjectMatrix2(G, target_obj, -1, NULL); + ok = ExecutiveSetObjectMatrix2(G, target_obj, -1, nullptr); } break; } @@ -2467,7 +2467,7 @@ int ExecutiveMatrixCopy2(PyMOLGlobals * G, ObjectSetTTT(target_obj, tttf, -1, -1); target_obj->invalidate(cRepNone, cRepInvExtents, -1); } else { - ObjectSetTTT(target_obj, NULL, -1, -1); + ObjectSetTTT(target_obj, nullptr, -1, -1); target_obj->invalidate(cRepNone, cRepInvExtents, -1); } break; @@ -2504,7 +2504,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, CExecutive *I = G->Executive; CTracker *I_Tracker = I->Tracker; - SpecRec *src_rec = NULL; + SpecRec *src_rec = nullptr; int ok = true; int copy_ttt_too = false; int matrix_mode = SettingGetGlobal_i(G, cSetting_matrix_mode); @@ -2542,7 +2542,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, switch (source_mode) { case 0: /* txf history is the source matrix */ { - double *history = NULL; + double *history = nullptr; int found = ExecutiveGetObjectMatrix(G, source_name, source_state, &history, false); if(found) { @@ -2560,7 +2560,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, { double temp_inverse[16]; if(target_undo) { - double *target_history = NULL; + double *target_history = nullptr; int target_found = ExecutiveGetObjectMatrix(G, rec->name, target_state, &target_history, @@ -2600,7 +2600,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, convertR44dTTTf(history, tttf); ExecutiveSetObjectTTT(G, rec->name, tttf, -1, quiet, -1); } else { - ExecutiveSetObjectTTT(G, rec->name, NULL, -1, quiet, -1); + ExecutiveSetObjectTTT(G, rec->name, nullptr, -1, quiet, -1); } /* to do: logging, return values, etc. */ break; @@ -2649,7 +2649,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, convertTTTfR44d(tttf, homo); ok = ExecutiveSetObjectMatrix(G, rec->name, -1, homo); } else { - ok = ExecutiveSetObjectMatrix(G, rec->name, -1, NULL); + ok = ExecutiveSetObjectMatrix(G, rec->name, -1, nullptr); } break; } @@ -2686,7 +2686,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, convertR44dTTTf(homo, tttf); ExecutiveSetObjectTTT(G, rec->name, tttf, -1, quiet, -1); } else { - ExecutiveSetObjectTTT(G, rec->name, NULL, -1, quiet, -1); + ExecutiveSetObjectTTT(G, rec->name, nullptr, -1, quiet, -1); } break; case 2: /* State */ @@ -2741,7 +2741,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, { double temp_inverse[16]; if(target_undo) { - double *target_history = NULL; + double *target_history = nullptr; int target_found = ExecutiveGetObjectMatrix(G, rec->name, target_state, &target_history, @@ -2774,7 +2774,7 @@ int ExecutiveMatrixCopy(PyMOLGlobals * G, convertR44dTTTf(history, tttf); ExecutiveSetObjectTTT(G, rec->name, tttf, -1, quiet, -1); } else { - ExecutiveSetObjectTTT(G, rec->name, NULL, -1, quiet, -1); + ExecutiveSetObjectTTT(G, rec->name, nullptr, -1, quiet, -1); } /* to do: logging, return values, etc. */ break; @@ -2801,7 +2801,7 @@ void ExecutiveInvalidateMapDependents( PyMOLGlobals* G, const char* map_name, const char* new_name) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { switch (rec->obj->type) { @@ -2847,7 +2847,7 @@ pymol::Result<> ExecutiveResetMatrix( switch (mode) { case 0: /* transformations already applied to the coordinates */ for (StateIterator iter(rec->obj, state); iter.next();) { - double *history = NULL; + double *history = nullptr; bool found = ExecutiveGetObjectMatrix2(G, rec->obj, iter.state, &history, false); if(found && history) { double temp_inverse[16]; @@ -2968,7 +2968,7 @@ static int ExecutiveCountNames(PyMOLGlobals * G) { int count = 0; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) count++; @@ -3012,7 +3012,7 @@ pymol::Result<> ExecutiveOrder(PyMOLGlobals * G, pymol::zstring_view s1View, int if(n_names) { SpecRec **list, **subset, **sorted; - int *index = NULL; + int *index = nullptr; int n_sel; int source_row = -1; int min_row = -1; @@ -3036,7 +3036,7 @@ pymol::Result<> ExecutiveOrder(PyMOLGlobals * G, pymol::zstring_view s1View, int assert(list_size == n_names); /* unlink them */ for(a = 0; a < n_names; a++) { - list[a]->next = NULL; + list[a]->next = nullptr; } } /* transfer matching names to the subset array */ @@ -3044,11 +3044,11 @@ pymol::Result<> ExecutiveOrder(PyMOLGlobals * G, pymol::zstring_view s1View, int int a; int entry; int min_entry = word_list->n_word; - const char *word = NULL; + const char *word = nullptr; int word_iter = 0; while(WordListIterate(G, word_list, &word, &word_iter)) { int list_id = ExecutiveGetNamesListFromPattern(G, word, true, false); - SpecRec *rec = NULL; + SpecRec *rec = nullptr; entry = word_iter - 1; for(a = n_names - 1; a > 0; a--) { /* skipping zeroth */ int iter_id = TrackerNewIter(I_Tracker, 0, list_id); @@ -3064,7 +3064,7 @@ pymol::Result<> ExecutiveOrder(PyMOLGlobals * G, pymol::zstring_view s1View, int /* ensure that each record appears only once */ rec->next = subset[entry]; subset[entry] = rec; - list[a] = NULL; + list[a] = nullptr; } } TrackerDelIter(I_Tracker, iter_id); @@ -3085,7 +3085,7 @@ pymol::Result<> ExecutiveOrder(PyMOLGlobals * G, pymol::zstring_view s1View, int sorted[n_sel++] = rec; last = rec; rec = rec->next; - last->next = NULL; + last->next = nullptr; } } } @@ -3103,8 +3103,8 @@ pymol::Result<> ExecutiveOrder(PyMOLGlobals * G, pymol::zstring_view s1View, int } /* reassemble the list using the new order */ { - SpecRec *spec = NULL; - SpecRec *last = NULL; + SpecRec *spec = nullptr; + SpecRec *last = nullptr; int a, b; int flag; for(a = 0; a < n_names; a++) { @@ -3179,7 +3179,7 @@ pymol::Result<> ExecutiveOrder(PyMOLGlobals * G, pymol::zstring_view s1View, int pymol::vla ExecutiveGetObjectMoleculeVLA(PyMOLGlobals * G, const char *sele) { - ObjectMolecule **result = NULL; + ObjectMolecule **result = nullptr; int s1 = SelectorIndexByName(G, sele); if(s1 >= 0) { ObjectMoleculeOpRec op; @@ -3220,7 +3220,7 @@ int ExecutiveSetDrag(PyMOLGlobals * G, const char *name, int quiet,int mode) SpecRec *rec = ExecutiveFindSpec(G, name); if(rec) { if(rec->type == cExecSelection) { - SelectorCreate(G, drag_name, name, NULL, true, NULL); + SelectorCreate(G, drag_name, name, nullptr, true, nullptr); need_sele = false; { int sele = SelectorIndexByName(G, drag_name); @@ -3253,9 +3253,9 @@ int ExecutiveSetDrag(PyMOLGlobals * G, const char *name, int quiet,int mode) PRINTFB(G, FB_Executive, FB_Errors) " Drag-Error: invalid or empty selection." ENDFB(G); } else if(EditorDraggingObjectMatrix(G)) { - SelectorCreate(G, drag_name, "none", NULL, true, NULL); + SelectorCreate(G, drag_name, "none", nullptr, true, nullptr); } else if(need_sele && (obj->type == cObjectMolecule) && (!EditorDraggingObjectMatrix(G))) { - SelectorCreate(G, drag_name, obj->Name, (ObjectMolecule*)(void*)obj, true, NULL); /* for indication only */ + SelectorCreate(G, drag_name, obj->Name, (ObjectMolecule*)(void*)obj, true, nullptr); /* for indication only */ } } else { EditorInactivate(G); @@ -3320,7 +3320,7 @@ int ExecutiveGetActiveAlignmentSele(PyMOLGlobals * G) * * 1) The "seq_view_alignment" setting if it's set * 2) or the name of the first enabled alignment object - * 3) or NULL + * 3) or nullptr */ const char* ExecutiveGetActiveAlignment(PyMOLGlobals* G) { @@ -3328,7 +3328,7 @@ const char* ExecutiveGetActiveAlignment(PyMOLGlobals* G) if(alignment && alignment[0]) { /* explicit alignment setting name */ return alignment; } else { /* otherwise, use the first active alignment */ - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; while(ListIterate(I->Spec, rec, next)) { if(rec->visible) { @@ -3357,7 +3357,7 @@ int ExecutiveGetActiveSeleName(PyMOLGlobals * G, char *name, int create_new, int /* TODO: cache/optimize to avoid table scan */ int result = false; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; while(ListIterate(I->Spec, rec, next)){ if(rec->type == cExecSelection){ @@ -3407,7 +3407,7 @@ pymol::Result<> ExecutiveFixChemistry(PyMOLGlobals * G, const char *s1, const ch SETUP_SELE_DEFAULT_PREFIXED(1, cSelectionInvalid); SETUP_SELE_DEFAULT_PREFIXED(2, sele1); - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; assert((sele1 >= 0) && (sele2 >= 0)); @@ -3438,7 +3438,7 @@ pymol::Result<> ExecutiveSetObjectColor(PyMOLGlobals * G, const char *name, cons int ExecutiveGetObjectColorIndex(PyMOLGlobals * G, const char *name) { int result = -1; - pymol::CObject *obj = NULL; + pymol::CObject *obj = nullptr; obj = ExecutiveFindObjectByName(G, name); if(obj) { result = obj->Color; @@ -3508,7 +3508,7 @@ pymol::Result> ExecutiveSetName( PyMOLGlobals * G, pymol::zstring_view old_name_view, pymol::zstring_view new_name_view, bool save) { std::vector discarded; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; int found = false; auto ignore_case = SettingGet(G, cSetting_ignore_case); @@ -3577,7 +3577,7 @@ pymol::Result> ExecutiveSetName( if(!found) return pymol::make_error("Could not find object named ", name); else { - rec = NULL; + rec = nullptr; int old_name_len = strlen(old_name); int new_name_len = strlen(name); ObjectNameType childname; @@ -3604,8 +3604,8 @@ pymol::Result> ExecutiveSetName( * Load any file type which is implemented in C. * * fname: File name, can be empty if content is provided - * content: File contents, if not NULL - * content_length: Length of "content", if not NULL + * content: File contents, if not nullptr + * content_length: Length of "content", if not nullptr * content_format: File type code * object_name: New object name * state: Object state to start loading new coordsets in @@ -3694,7 +3694,7 @@ ExecutiveLoadPrepareArgs(PyMOLGlobals * G, case cLoadTypeXYZStr: case cLoadTypeDXStr: if (!content) { - return pymol::Error("content is NULL"); + return pymol::Error("content is nullptr"); } fname_null_ok = true; break; @@ -3857,7 +3857,7 @@ pymol::Result<> ExecutiveLoad(PyMOLGlobals* G, ExecutiveLoadArgs const& args) int ok = true; OrthoLineType buf = ""; int pdb_variant = PDB_VARIANT_DEFAULT; - pymol::CObject *obj = NULL; + pymol::CObject *obj = nullptr; // downstream file type reading functions switch (content_format) { @@ -3901,14 +3901,14 @@ pymol::Result<> ExecutiveLoad(PyMOLGlobals* G, ExecutiveLoadArgs const& args) if(origObj) { /* always reinitialize topology objects from scratch */ ExecutiveDelete(G, origObj->Name); - origObj = NULL; + origObj = nullptr; } - obj = ObjectMoleculeLoadTOPFile(G, NULL, fname, state, discrete); + obj = ObjectMoleculeLoadTOPFile(G, nullptr, fname, state, discrete); break; case cLoadTypeTRJ: if(origObj) { ObjectMoleculeLoadTRJFile(G, (ObjectMolecule *) origObj, fname, state, - 1, 1, 1, -1, -1, NULL, 1, NULL, quiet); + 1, 1, 1, -1, -1, nullptr, 1, nullptr, quiet); } else { return pymol::Error("must load object topology before loading trajectory!"); } @@ -3991,7 +3991,7 @@ pymol::Result<> ExecutiveLoad(PyMOLGlobals* G, ExecutiveLoadArgs const& args) const char * next_entry = content; char new_name[WordLength] = ""; - OVLexicon *loadproplex = NULL; + OVLexicon *loadproplex = nullptr; bool loadpropertiesall = false; // (some of) these file types support multiple molecules per file, @@ -4009,7 +4009,7 @@ pymol::Result<> ExecutiveLoad(PyMOLGlobals* G, ExecutiveLoadArgs const& args) ExecutiveDelete(G, obj->Name); // just in case there is a collision ExecutiveManageObject(G, obj, zoom, true); new_name[0] = 0; - obj = NULL; + obj = nullptr; } } while(next_entry); @@ -4018,7 +4018,7 @@ pymol::Result<> ExecutiveLoad(PyMOLGlobals* G, ExecutiveLoadArgs const& args) break; default: if(plugin[0]) { - obj = PlugIOManagerLoad(G, origObj ? &origObj : NULL, fname, state, quiet, + obj = PlugIOManagerLoad(G, origObj ? &origObj : nullptr, fname, state, quiet, plugin, args.plugin_mask); } else { return pymol::make_error("Unable to read that file type from C (", @@ -4068,7 +4068,7 @@ pymol::Result<> ExecutiveLoad(PyMOLGlobals* G, ExecutiveLoadArgs const& args) */ pymol::CObject* ExecutiveGetExistingCompatible(PyMOLGlobals * G, const char* oname, cLoadType_t type) { - pymol::CObject *origObj = NULL; + pymol::CObject *origObj = nullptr; origObj = ExecutiveFindObjectByName(G, oname); /* check for existing object of right type, delete if not */ if(origObj) { @@ -4137,7 +4137,7 @@ pymol::CObject* ExecutiveGetExistingCompatible(PyMOLGlobals * G, const char* ona } if(new_type == -1 || new_type != origObj->type) { ExecutiveDelete(G, origObj->Name); - origObj = NULL; + origObj = nullptr; } } return origObj; @@ -4153,12 +4153,12 @@ int ExecutiveProcessPDBFile(PyMOLGlobals * G, pymol::CObject * origObj, pymol::CObject *obj; char pdb_name[WordLength] = ""; char cur_name[WordLength] = ""; - const char *next_pdb = NULL; + const char *next_pdb = nullptr; int repeat_flag = true; int n_processed = 0; - PDBInfoRec pdb_info_rec, *pdb_info = NULL; + PDBInfoRec pdb_info_rec, *pdb_info = nullptr; int model_number; - pymol::CObject *deferred_zoom_obj = NULL; + pymol::CObject *deferred_zoom_obj = nullptr; UtilZeroMem(&pdb_info_rec, sizeof(PDBInfoRec)); pdb_info = &pdb_info_rec; @@ -4177,7 +4177,7 @@ int ExecutiveProcessPDBFile(PyMOLGlobals * G, pymol::CObject * origObj, } repeat_flag = false; - next_pdb = NULL; + next_pdb = nullptr; if(!origObj) { is_new = true; @@ -4274,7 +4274,7 @@ int ExecutiveProcessPDBFile(PyMOLGlobals * G, pymol::CObject * origObj, if(do_zoom != zoom) deferred_zoom_obj = obj; else - deferred_zoom_obj = NULL; + deferred_zoom_obj = nullptr; ExecutiveManageObject(G, obj, do_zoom, true); if(eff_frame < 0) eff_frame = ((ObjectMolecule *) obj)->NCSet - 1; @@ -4349,9 +4349,9 @@ PyObject *ExecutiveGetVisAsPyDict(PyMOLGlobals * G) { assert(PyGILState_Check()); - PyObject *result = NULL, *list; + PyObject *result = nullptr, *list; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; result = PyDict_New(); while(ListIterate(I->Spec, rec, next)) { if(rec->name[0] != '_') { @@ -4416,7 +4416,7 @@ int *ExecutiveGetRepsForObject(PyMOLGlobals *G, const char *name){ if(rec) return getRepArrayFromBitmask(rec->obj->visRep); - return NULL; + return nullptr; } #endif @@ -4430,20 +4430,20 @@ int ExecutiveSetVisFromPyDict(PyMOLGlobals * G, PyObject * dict) int ok = true; WordType name; PyObject *key, *list, *col; - PyObject *vis_list = NULL; + PyObject *vis_list = nullptr; Py_ssize_t pos = 0; - SpecRec *rec, *grec, **recstack = NULL; + SpecRec *rec, *grec, **recstack = nullptr; int n_vis; int rep; int a; int ll = 0; if(ok) - ok = (dict != NULL); + ok = (dict != nullptr); if(ok) ok = PyDict_Check(dict); if(ok) { - SceneObjectDel(G, NULL, true); /* remove all objects from scene */ + SceneObjectDel(G, nullptr, true); /* remove all objects from scene */ ExecutiveInvalidateSceneMembers(G); // stack for putative visible records @@ -4456,7 +4456,7 @@ int ExecutiveSetVisFromPyDict(PyMOLGlobals * G, PyObject * dict) rec = ExecutiveFindSpec(G, name); if(rec) { if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -4473,7 +4473,7 @@ int ExecutiveSetVisFromPyDict(PyMOLGlobals * G, PyObject * dict) if(ll > 2) { /* object visibility */ vis_list = PyList_GetItem(list, 2); if(ok) - ok = (vis_list != NULL); + ok = (vis_list != nullptr); if(ok) { if(PyList_Check(vis_list)) { n_vis = PyList_Size(vis_list); @@ -4492,7 +4492,7 @@ int ExecutiveSetVisFromPyDict(PyMOLGlobals * G, PyObject * dict) if(ll > 3) { /* object color */ col = PyList_GetItem(list, 3); if(ok) - ok = (col != NULL); + ok = (col != nullptr); if(ok) if(PyInt_Check(col)) { ok = PConvPyObjectToInt(col, &rec->obj->Color); @@ -4543,7 +4543,7 @@ CField * ExecutiveGetVolumeField(PyMOLGlobals * G, const char * objName, int sta } ok_except1: - return NULL; + return nullptr; } /** @@ -4552,7 +4552,7 @@ CField * ExecutiveGetVolumeField(PyMOLGlobals * G, const char * objName, int sta pymol::Result> ExecutiveGetHistogram(PyMOLGlobals * G, const char * objName, int n_points, float min_val, float max_val) { pymol::CObject *obj; - ObjectMapState *oms = NULL; + ObjectMapState *oms = nullptr; obj = ExecutiveFindObjectByName(G, objName); @@ -4573,7 +4573,7 @@ ExecutiveGetHistogram(PyMOLGlobals * G, const char * objName, int n_points, floa if(oms) { auto hist = std::vector(n_points + 4); - float range = SettingGet_f(G, obj->Setting.get(), NULL, cSetting_volume_data_range); + float range = SettingGet_f(G, obj->Setting.get(), nullptr, cSetting_volume_data_range); ObjectMapStateGetHistogram( G, oms, n_points, range, hist.data(), min_val, max_val); return hist; @@ -4868,7 +4868,7 @@ int ExecutiveValidateObjectPtr(PyMOLGlobals * G, pymol::CObject * ptr, int objec CExecutive *I = G->Executive; int ok = false; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->obj == ptr) { @@ -4888,11 +4888,11 @@ pymol::Result<> ExecutiveRampNew(PyMOLGlobals* G, const char* name, int src_state, const char* sele, float beyond, float within, float sigma, int zero, int calc_mode, int quiet) { - ObjectGadgetRamp *obj = NULL; - ObjectGadgetRamp *origRamp = NULL; - pymol::CObject *src_obj = NULL; + ObjectGadgetRamp *obj = nullptr; + ObjectGadgetRamp *origRamp = nullptr; + pymol::CObject *src_obj = nullptr; pymol::CObject *origObj = ExecutiveFindObjectByName(G, name); - float *vert_vla = NULL; + float *vert_vla = nullptr; int rampType = -1; if (origObj && @@ -4975,13 +4975,13 @@ static int ExecutiveSetNamedEntries(PyMOLGlobals * G, PyObject * names, int vers int skip = false; int a = 0, l = 0, ll = 0; PyObject *cur, *el; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int extra_int; int incomplete = false; ObjectNameType new_name; if(ok) - ok = (names != NULL); + ok = (names != nullptr); if(ok) ok = PyList_Check(names); if(ok) @@ -4991,9 +4991,9 @@ static int ExecutiveSetNamedEntries(PyMOLGlobals * G, PyObject * names, int vers cur = PyList_GetItem(names, a); if(cur != Py_None) { /* skip over None w/o aborting */ skip = false; - rec = NULL; + rec = nullptr; ListElemCalloc(G, rec, SpecRec); - rec->next = NULL; + rec->next = nullptr; rec->name[0] = 0; if(ok) ok = PyList_Check(cur); @@ -5159,12 +5159,12 @@ static int ExecutiveSetSelectionsFromPyList(PyMOLGlobals * G, PyObject * names) int ok = true; int a = 0, l = 0; PyObject *cur; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int extra; int incomplete = false; if(ok) - ok = (names != NULL); + ok = (names != nullptr); if(ok) ok = PyList_Check(names); if(ok) @@ -5172,9 +5172,9 @@ static int ExecutiveSetSelectionsFromPyList(PyMOLGlobals * G, PyObject * names) while(ok && (a < l)) { cur = PyList_GetItem(names, a); if(cur != Py_None) { /* skip over None w/o aborting */ - rec = NULL; + rec = nullptr; ListElemCalloc(G, rec, SpecRec); - rec->next = NULL; + rec->next = nullptr; if(ok) ok = PyList_Check(cur); @@ -5205,7 +5205,7 @@ static int ExecutiveSetSelectionsFromPyList(PyMOLGlobals * G, PyObject * names) static PyObject *ExecutiveGetExecObjectAsPyList(PyMOLGlobals * G, SpecRec * rec) { - PyObject *result = NULL; + PyObject *result = nullptr; int recobjtype = rec->obj->type; switch (recobjtype){ case cObjectMesh: @@ -5274,7 +5274,7 @@ static PyObject *ExecutiveGetExecObjectAsPyList(PyMOLGlobals * G, SpecRec * rec) static PyObject *ExecutiveGetExecSeleAsPyList(PyMOLGlobals * G, SpecRec * rec) { - PyObject *result = NULL; + PyObject *result = nullptr; int sele; sele = SelectorIndexByName(G, rec->name); @@ -5297,10 +5297,10 @@ static PyObject *ExecutiveGetNamedEntries(PyMOLGlobals * G, int list_id, int par { CExecutive *I = G->Executive; CTracker *I_Tracker = I->Tracker; - PyObject *result = NULL; + PyObject *result = nullptr; int count = 0, total_count = 0; int iter_id = 0; - SpecRec *rec = NULL, *list_rec = NULL; + SpecRec *rec = nullptr, *list_rec = nullptr; SelectorUpdateTable(G, cSelectorUpdateTableAllStates, -1); @@ -6283,7 +6283,7 @@ int ExecutiveDebug(PyMOLGlobals * G, const char *name) int ***ExecutiveGetBondPrint(PyMOLGlobals * G, const char *name, int max_bond, int max_type, int *dim) { - int ***result = NULL; + int ***result = nullptr; pymol::CObject *obj; ObjectMolecule *objMol; @@ -6313,7 +6313,7 @@ pymol::Result<> ExecutiveMapSet(PyMOLGlobals* G, const char* name, CTracker *I_Tracker = I->Tracker; int isNew = false; ObjectMap *target = ExecutiveFindObjectMapByName(G, name); - ObjectMap *first_operand = NULL; + ObjectMap *first_operand = nullptr; int src_state_start = 0, src_state_stop = 0; int list_id = ExecutiveGetNamesListFromPattern(G, operands, true, true); @@ -6737,7 +6737,7 @@ const char * ExecutiveMapGenerate(PyMOLGlobals * G, const char * name, const cha #endif if (!ok) - return NULL; + return nullptr; else return (const char*) tempFile; @@ -6751,9 +6751,9 @@ ExecutiveMapNew(PyMOLGlobals * G, const char *name, int type, float grid_spacing int quiet, int zoom, int normalize, float clamp_floor, float clamp_ceiling, float resolution) { - pymol::CObject *origObj = NULL; + pymol::CObject *origObj = nullptr; ObjectMap *objMap; - ObjectMapState *ms = NULL; + ObjectMapState *ms = nullptr; int a; float v[3]; ObjectMapDesc _md, *md; @@ -6789,7 +6789,7 @@ ExecutiveMapNew(PyMOLGlobals * G, const char *name, int type, float grid_spacing } } - n_st = ExecutiveCountStates(G, NULL); + n_st = ExecutiveCountStates(G, nullptr); for(st = 0; st < n_st; st++) { if(state == -1) @@ -6913,22 +6913,22 @@ int ExecutiveSculptIterateAll(PyMOLGlobals * G) float center_array[8] = { 0.0F, 0.0F, 0.0F, 0.0F }; float *center = center_array; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; ObjectMolecule *objMol; CGOReset(G->DebugCGO); if(SettingGetGlobal_b(G, cSetting_sculpting)) { if(!SettingGetGlobal_b(G, cSetting_sculpt_auto_center)) - center = NULL; + center = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { if(rec->obj->type == cObjectMolecule) { objMol = (ObjectMolecule *) rec->obj; - if(SettingGet_b(G, NULL, objMol->Setting.get(), cSetting_sculpting)) { + if(SettingGet_b(G, nullptr, objMol->Setting.get(), cSetting_sculpting)) { constexpr int state = -2; // current state ObjectMoleculeSculptIterate(objMol, state, - SettingGet_i(G, NULL, objMol->Setting.get(), + SettingGet_i(G, nullptr, objMol->Setting.get(), cSetting_sculpting_cycles), center); active = true; } @@ -6944,7 +6944,7 @@ int ExecutiveSculptIterateAll(PyMOLGlobals * G) scale3f(center + 4, center[7], center + 4); subtract3f(center, center + 4, center); add3f(pos, center, center); - ExecutiveCenter(G, NULL, -1, true, false, center, true); + ExecutiveCenter(G, nullptr, -1, true, false, center, true); } } if (active){ @@ -6959,7 +6959,7 @@ float ExecutiveSculptIterate(PyMOLGlobals * G, const char *name, int state, int { pymol::CObject *obj = ExecutiveFindObjectByName(G, name); CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; ObjectMolecule *objMol; float total_strain = 0.0F; @@ -6968,7 +6968,7 @@ float ExecutiveSculptIterate(PyMOLGlobals * G, const char *name, int state, int if(rec->type == cExecObject) { if(rec->obj->type == cObjectMolecule) { objMol = (ObjectMolecule *) rec->obj; - total_strain += ObjectMoleculeSculptIterate(objMol, state, n_cycle, NULL); + total_strain += ObjectMoleculeSculptIterate(objMol, state, n_cycle, nullptr); } } } @@ -6980,7 +6980,7 @@ float ExecutiveSculptIterate(PyMOLGlobals * G, const char *name, int state, int "Executive-Error: object %s is not a molecular object.\n", name ENDFB(G); } else { total_strain = - ObjectMoleculeSculptIterate((ObjectMolecule *) obj, state, n_cycle, NULL); + ObjectMoleculeSculptIterate((ObjectMolecule *) obj, state, n_cycle, nullptr); } return (total_strain); } @@ -6991,7 +6991,7 @@ int ExecutiveSculptActivate(PyMOLGlobals * G, const char *name, int state, int m int match_by_segment) { pymol::CObject *obj = ExecutiveFindObjectByName(G, name); - SpecRec *rec = NULL; + SpecRec *rec = nullptr; ObjectMolecule *objMol; CExecutive *I = G->Executive; int ok = true; @@ -7027,7 +7027,7 @@ int ExecutiveSculptActivate(PyMOLGlobals * G, const char *name, int state, int m int ExecutiveSculptDeactivate(PyMOLGlobals * G, const char *name) { pymol::CObject *obj = ExecutiveFindObjectByName(G, name); - SpecRec *rec = NULL; + SpecRec *rec = nullptr; ObjectMolecule *objMol; CExecutive *I = G->Executive; @@ -7578,10 +7578,10 @@ int ExecutivePhiPsi(PyMOLGlobals * G, const char *s1, ObjectMolecule *** objVLA, *phiVLA = op1.f1VLA; *psiVLA = op1.f2VLA; } else { - *objVLA = NULL; - *iVLA = NULL; - *phiVLA = NULL; - *psiVLA = NULL; + *objVLA = nullptr; + *iVLA = nullptr; + *phiVLA = nullptr; + *psiVLA = nullptr; } return (result); } @@ -7595,15 +7595,15 @@ int ExecutiveAlign(PyMOLGlobals * G, const char *s1, const char *s2, const char { int sele1 = SelectorIndexByName(G, s1); int sele2 = SelectorIndexByName(G, s2); - int *vla1 = NULL; - int *vla2 = NULL; + int *vla1 = nullptr; + int *vla2 = nullptr; int na, nb; int c; int ok = true; int use_sequence = (mat_file && mat_file[0] && (seq_wt != 0.0F)); int use_structure = (seq_wt >= 0.0F); /* negative seq_wt means sequence only! */ - ObjectMolecule *mobile_obj = NULL; - CMatch *match = NULL; + ObjectMolecule *mobile_obj = nullptr; + CMatch *match = nullptr; if(!use_structure) window = 0; @@ -7623,7 +7623,7 @@ int ExecutiveAlign(PyMOLGlobals * G, const char *s1, const char *s2, const char } } if(ok && (sele1 >= 0) && (sele2 >= 0) && rms_info) { - vla1 = SelectorGetResidueVLA(G, sele1, use_structure, NULL); + vla1 = SelectorGetResidueVLA(G, sele1, use_structure, nullptr); vla2 = SelectorGetResidueVLA(G, sele2, use_structure, mobile_obj); if(vla1 && vla2) { na = VLAGetSize(vla1) / 3; @@ -7758,9 +7758,9 @@ pymol::Result ExecutiveCartoon(PyMOLGlobals* G, int type, const char* s1) /*========================================================================*/ float *ExecutiveGetVertexVLA(PyMOLGlobals * G, const char *s1, int state) { - /* returns NULL if none found */ + /* returns nullptr if none found */ - float *result = NULL; + float *result = nullptr; ObjectMoleculeOpRec op1; int sele1; sele1 = SelectorIndexByName(G, s1); @@ -7792,9 +7792,9 @@ PyObject *ExecutiveGetSettingOfType(PyMOLGlobals * G, int index, { assert(PyGILState_Check()); - PyObject *result = NULL; - pymol::CObject *obj = NULL; - CSetting *set_ptr1 = NULL, *set_ptr2 = NULL; + PyObject *result = nullptr; + pymol::CObject *obj = nullptr; + CSetting *set_ptr1 = nullptr, *set_ptr2 = nullptr; pymol::copyable_ptr* handle = nullptr; if(object && object[0]) { @@ -7933,7 +7933,7 @@ const char *ExecutiveGetTitle(PyMOLGlobals * G, const char *name, int state) if(!obj) { PRINTFB(G, FB_ObjectMolecule, FB_Errors) "Error: object %s not found.\n", name ENDFB(G); - return NULL; + return nullptr; } return ObjectMoleculeGetStateTitle(obj, state); } @@ -7943,7 +7943,7 @@ const char *ExecutiveGetTitle(PyMOLGlobals * G, const char *name, int state) void ExecutiveHideSelections(PyMOLGlobals * G) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecSelection) { @@ -7965,7 +7965,7 @@ void ExecutiveInvalidateSelectionIndicators(PyMOLGlobals *G){ void ExecutiveInvalidateSelectionIndicatorsCGO(PyMOLGlobals *G){ CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; if (I){ if (I->selIndicatorsCGO){ CGOFree(I->selIndicatorsCGO); @@ -8082,7 +8082,7 @@ static void ExecutiveRenderIndicatorCGO(PyMOLGlobals * G, CGO *selIndicatorsCGO) shaderPrg->Set4f("viewport", v[0], v[1], v[2], v[3]); if(no_depth) glDisable(GL_DEPTH_TEST); - CGORender(selIndicatorsCGO, NULL, NULL, NULL, NULL, NULL); + CGORender(selIndicatorsCGO, nullptr, nullptr, nullptr, nullptr, nullptr); if(no_depth) glEnable(GL_DEPTH_TEST); glDisable(GL_VERTEX_PROGRAM_POINT_SIZE); @@ -8140,7 +8140,7 @@ static void ExecutiveSetupIndicatorPassGLImmediate(PyMOLGlobals * G, SpecRec *re void ExecutiveRenderSelections(PyMOLGlobals * G, int curState, int slot, GridInfo *grid) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int any_active = false; int no_depth = (int) SettingGetGlobal_f(G, cSetting_selection_overlay); short use_shader = (short) SettingGetGlobal_b(G, cSetting_use_shaders); @@ -8155,7 +8155,7 @@ void ExecutiveRenderSelections(PyMOLGlobals * G, int curState, int slot, GridInf if(width_scale >= 0.0F) { width = (int) ((width_scale * fabs(SettingGetGlobal_f(G, cSetting_stick_radius)) / - SceneGetScreenVertexScale(G, NULL))); + SceneGetScreenVertexScale(G, nullptr))); if(width < min_width) width = (int) min_width; else if(width > max_width) @@ -8187,7 +8187,7 @@ void ExecutiveRenderSelections(PyMOLGlobals * G, int curState, int slot, GridInf } } } - rec = NULL; + rec = nullptr; } else if (I->selIndicatorsCGO){ ExecutiveRenderIndicatorCGO(G, I->selIndicatorsCGO); return; @@ -8225,7 +8225,7 @@ void ExecutiveRenderSelections(PyMOLGlobals * G, int curState, int slot, GridInf (void)fog; - rec = NULL; + rec = nullptr; if(round_points) { glEnable(GL_POINT_SMOOTH); @@ -8308,7 +8308,7 @@ void ExecutiveRenderSelections(PyMOLGlobals * G, int curState, int slot, GridInf ExecutiveSetupIndicatorPassGLImmediate(G, rec, pass, gl_width, width); glBegin(GL_POINTS); } - rec1 = NULL; + rec1 = nullptr; while(ListIterate(I->Spec, rec1, next)) { if(rec1->type == cExecObject) { if(rec1->obj->type == cObjectMolecule) { @@ -8319,7 +8319,7 @@ void ExecutiveRenderSelections(PyMOLGlobals * G, int curState, int slot, GridInf } else if (!rec1->gridSlotSelIndicatorsCGO){ if (!use_shader){ ObjectMoleculeRenderSele((ObjectMolecule *) rec1->obj, curState, sele, - vis_only, NULL); + vis_only, nullptr); } else { rec1->gridSlotSelIndicatorsCGO = CGONew(G); CGODotwidth(rec1->gridSlotSelIndicatorsCGO, gl_width); @@ -8581,7 +8581,7 @@ pymol::Result> ExecutiveGetNames( mode >= cGetNames_public && mode <= cGetNames_public_group_objects; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; std::vector result; pymol::Result tmpsele0; SelectorID_t sele0 = cSelectionInvalid; @@ -8769,7 +8769,7 @@ pymol::Result<> ExecutiveFuse(PyMOLGlobals* G, const char* s0, const char* s1, ObjectMoleculeVerifyChemistry(obj0, -1); ObjectMoleculeVerifyChemistry(obj1, -1); - SelectorCreate(G, tmp_fuse_sele, NULL, obj0, 1, NULL); + SelectorCreate(G, tmp_fuse_sele, nullptr, obj0, 1, nullptr); sele2 = SelectorIndexByName(G, tmp_fuse_sele); if(mode) { ObjectMoleculeOpRecInit(&op); @@ -8797,7 +8797,7 @@ pymol::Result<> ExecutiveFuse(PyMOLGlobals* G, const char* s0, const char* s1, pymol::Result<> ExecutiveSpheroid(PyMOLGlobals * G, const char *name, int average) { /* EXPERIMENTAL */ CExecutive *I = G->Executive; - pymol::CObject *os = NULL; + pymol::CObject *os = nullptr; if(strlen(name)) { os = ExecutiveFindObjectByName(G, name); @@ -8829,7 +8829,7 @@ pymol::Result<> ExecutiveSpheroid(PyMOLGlobals * G, const char *name, int averag void ExecutiveRebuildAll(PyMOLGlobals * G) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; PRINTFD(G, FB_Executive) " ExecutiveRebuildAll: entered.\n" ENDFD; auto defer_builds_mode = SettingGet(G, cSetting_defer_builds_mode); @@ -8861,7 +8861,7 @@ void ExecutiveRebuildAll(PyMOLGlobals * G) void ExecutiveRebuildAllObjectDist(PyMOLGlobals * G) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { if(rec->obj->type == cObjectMeasurement) { @@ -8877,8 +8877,8 @@ void ExecutiveRebuildAllObjectDist(PyMOLGlobals * G) void ExecutiveUndo(PyMOLGlobals * G, int dir) { CExecutive *I = G->Executive; - ObjectMolecule *obj = NULL, *compObj; - SpecRec *rec = NULL; + ObjectMolecule *obj = nullptr, *compObj; + SpecRec *rec = nullptr; auto o = ExecutiveGetLastObjectEdited(G); PRINTFB(G, FB_Executive, FB_Debugging) @@ -8908,7 +8908,7 @@ pymol::Result<> ExecutiveSort(PyMOLGlobals* G, const char* name) { CExecutive *I = G->Executive; ObjectMolecule *obj; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; ObjectMoleculeOpRec op; int sele; int ok = true; @@ -8924,7 +8924,7 @@ pymol::Result<> ExecutiveSort(PyMOLGlobals* G, const char* name) if(rec) { switch (rec->type) { case cExecAll: - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule)) { obj = (ObjectMolecule *) rec->obj; @@ -8991,8 +8991,8 @@ pymol::Result<> ExecutiveRemoveAtoms(PyMOLGlobals * G, const char *s1, int quiet SETUP_SELE_DEFAULT(1); CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; ObjectMoleculeOpRec op; { @@ -9131,7 +9131,7 @@ pymol::Result<> ExecutiveFlag(PyMOLGlobals * G, int flag, const char* sele, int } if(SettingGetGlobal_b(G, cSetting_auto_indicate_flags)) { auto buffer = pymol::string_format("(flag %d)", flag); - SelectorCreate(G, cIndicateSele, buffer.c_str(), NULL, true, NULL); + SelectorCreate(G, cIndicateSele, buffer.c_str(), nullptr, true, nullptr); ExecutiveSetObjVisib(G, cIndicateSele, true, false); SceneInvalidate(G); } @@ -9340,7 +9340,7 @@ pymol::Result<> ExecutiveBond(PyMOLGlobals* G, const char* s1, const char* s2, { int cnt; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int flag = false; SETUP_SELE_DEFAULT_PREFIXED(1, cSelectionInvalid); @@ -9569,12 +9569,12 @@ pymol::Result ExecutiveDistance(PyMOLGlobals* G, const char* nam, char *ExecutiveNameToSeqAlignStrVLA(PyMOLGlobals * G, const char *name, int state, int format, int quiet) { - char *result = NULL; + char *result = nullptr; if((!name) || (!name[0]) || (strcmp(name, "(all)") == 0)) { /* use current alignment as the default */ name = SettingGetGlobal_s(G, cSetting_seq_view_alignment); if(name[0] == 0) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; while(ListIterate(I->Spec, rec, next)) { if(rec->visible) { @@ -9621,7 +9621,7 @@ pymol::Result<> ExecutiveSeleToObject(PyMOLGlobals* G, const char* name, name = valid_name; } { - int exists = (ExecutiveFindObjectMoleculeByName(G, name) != NULL); + int exists = (ExecutiveFindObjectMoleculeByName(G, name) != nullptr); if(sele1 >= 0) { ok = SelectorCreateObjectMolecule(G, sele1, name, target, @@ -10061,8 +10061,8 @@ pymol::Result ExecutiveIterateList(PyMOLGlobals* G, const char* str1, int n_eval = 0; SelectorTmp s1(G, str1); int sele0 = s1.getIndex(); - PyObject *entry = NULL; - ObjectMolecule *obj = NULL; + PyObject *entry = nullptr; + ObjectMolecule *obj = nullptr; if(sele0 >= 0) obj = SelectorGetSingleObjectMolecule(G, sele0); if(obj) { @@ -10070,7 +10070,7 @@ pymol::Result ExecutiveIterateList(PyMOLGlobals* G, const char* str1, int list_len = 0; int a; int index = 0; - const char *expr = NULL; + const char *expr = nullptr; if(ok) ok = PyList_Check(list); if(ok) { @@ -10090,7 +10090,7 @@ pymol::Result ExecutiveIterateList(PyMOLGlobals* G, const char* str1, ok = ((index <= n_atom) && (index > 0)); if(ok) { - CoordSet *cs = NULL; + CoordSet *cs = nullptr; if(obj->DiscreteFlag && obj->DiscreteCSet) { cs = obj->DiscreteCSet[index - 1]; } else if (obj->NCSet == 1){ @@ -10179,7 +10179,7 @@ pymol::Result ExecutiveIterateState(PyMOLGlobals* G, int state, } if(!read_only) { // for dynamic_measures - ExecutiveUpdateCoordDepends(G, NULL); + ExecutiveUpdateCoordDepends(G, nullptr); SeqChanged(G); } if(!quiet) { @@ -10264,7 +10264,7 @@ int ExecutiveRMS(PyMOLGlobals * G, const char *s1, const char *s2, int mode, flo int ok = true; int repeat; float v1[3], *v2; - ObjectAlignment *align_to_update = NULL; + ObjectAlignment *align_to_update = nullptr; bool ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); bool ignore_case_chain = SettingGetGlobal_b(G, cSetting_ignore_case_chain); @@ -10340,7 +10340,7 @@ int ExecutiveRMS(PyMOLGlobals * G, const char *s1, const char *s2, int mode, flo if(op1.vv1 && op2.vv1) { if(op1.nvv1 && op2.nvv1) { - ObjectMolecule *mobile_obj = NULL; + ObjectMolecule *mobile_obj = nullptr; int n_pair = 0; @@ -10664,7 +10664,7 @@ int ExecutiveRMS(PyMOLGlobals * G, const char *s1, const char *s2, int mode, flo } if(mode != 0) { - rms = MatrixFitRMSTTTf(G, n_pair, op1.vv1, op2.vv1, NULL, op2.ttt); + rms = MatrixFitRMSTTTf(G, n_pair, op1.vv1, op2.vv1, nullptr, op2.ttt); if(rms_info) { rms_info->initial_rms = rms; rms_info->final_rms = rms; @@ -10718,7 +10718,7 @@ int ExecutiveRMS(PyMOLGlobals * G, const char *s1, const char *s2, int mode, flo n_pair = n_next; FreeP(flag); if(n_pair) { - rms = MatrixFitRMSTTTf(G, n_pair, op1.vv1, op2.vv1, NULL, op2.ttt); + rms = MatrixFitRMSTTTf(G, n_pair, op1.vv1, op2.vv1, nullptr, op2.ttt); if(rms_info) { rms_info->n_cycles_run = b; rms_info->final_n_atom = n_pair; @@ -10730,7 +10730,7 @@ int ExecutiveRMS(PyMOLGlobals * G, const char *s1, const char *s2, int mode, flo } } } else { /* mode == 0 -- simple RMS, with no coordinate movement */ - rms = MatrixGetRMS(G, n_pair, op1.vv1, op2.vv1, NULL); + rms = MatrixGetRMS(G, n_pair, op1.vv1, op2.vv1, nullptr); if(rms_info) { rms_info->initial_rms = rms; rms_info->final_rms = rms; @@ -10774,7 +10774,7 @@ int ExecutiveRMS(PyMOLGlobals * G, const char *s1, const char *s2, int mode, flo VLASize(align_vla, int, n_pair * 3); } { - ObjectAlignment *obj = NULL; + ObjectAlignment *obj = nullptr; /* does object already exist? */ { @@ -10945,13 +10945,13 @@ pymol::Result> ExecutiveRMSStates( ObjectMoleculeOpRec op1; ObjectMoleculeOpRec op2; - float *result = NULL; + float *result = nullptr; int ok = true; ObjectMoleculeOpRecInit(&op1); ObjectMoleculeOpRecInit(&op2); - op1.vv1 = NULL; - op2.vv1 = NULL; + op1.vv1 = nullptr; + op2.vv1 = nullptr; ObjectMolecule* obj = SelectorGetSingleObjectMolecule(G, sele1); @@ -11089,9 +11089,9 @@ float ExecutiveRMSPairs(PyMOLGlobals* G, const std::vector& sele, ErrMessage(G, __func__, buffer); } else if(op1.nvv1) { if(mode != 0) - rms = MatrixFitRMSTTTf(G, op1.nvv1, op1.vv1, op2.vv1, NULL, op2.ttt); + rms = MatrixFitRMSTTTf(G, op1.nvv1, op1.vv1, op2.vv1, nullptr, op2.ttt); else - rms = MatrixGetRMS(G, op1.nvv1, op1.vv1, op2.vv1, NULL); + rms = MatrixGetRMS(G, op1.nvv1, op1.vv1, op2.vv1, nullptr); if (!quiet) PRINTFB(G, FB_Executive, FB_Results) @@ -11308,7 +11308,7 @@ int ExecutiveRay(PyMOLGlobals * G, int width, int height, int mode, if(defer && (mode == 0)) { SceneDeferRay(G, width, height, mode, angle, shift, quiet, true, antialias); } else { - SceneRay(G, width, height, mode, NULL, NULL, angle, shift, quiet, NULL, true, + SceneRay(G, width, height, mode, nullptr, nullptr, angle, shift, quiet, nullptr, true, antialias); } return 1; @@ -11318,8 +11318,8 @@ int ExecutiveRay(PyMOLGlobals * G, int width, int height, int mode, /*========================================================================*/ int *ExecutiveGetG3d(PyMOLGlobals * G) { - int *result = NULL; - SceneRay(G, 0, 0, 3, NULL, NULL, 0.0F, 0.0F, true, (G3dPrimitive **) (void *) &result, + int *result = nullptr; + SceneRay(G, 0, 0, 3, nullptr, nullptr, 0.0F, 0.0F, true, (G3dPrimitive **) (void *) &result, false, -1); return result; } @@ -11330,8 +11330,8 @@ int ExecutiveSetBondSettingFromString(PyMOLGlobals * G, int quiet, int updates) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; int sele1, sele2; SettingName name; int ok = true; @@ -11407,7 +11407,7 @@ int ExecutiveSetBondSettingFromString(PyMOLGlobals * G, } if(ok && have_value) { - rec = NULL; + rec = nullptr; while((ListIterate(I->Spec, rec, next))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule)) { obj = (ObjectMolecule *) rec->obj; @@ -11464,8 +11464,8 @@ PyObject *ExecutiveGetBondSetting(PyMOLGlobals * G, int index, assert(PyGILState_Check()); CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; int sele1, sele2; SettingName name; PyObject *result = PyList_New(0); @@ -11483,8 +11483,8 @@ PyObject *ExecutiveGetBondSetting(PyMOLGlobals * G, int index, const BondType *bi = obj->Bond.data(); const AtomInfoType *ai1, *ai2, *ai = obj->AtomInfo.data(); - PyObject *pyObjList = NULL; - PyObject *pyBondList = NULL; + PyObject *pyObjList = nullptr; + PyObject *pyBondList = nullptr; for(a = 0; a < nBond; a++) { ai1 = ai + bi->index[0]; @@ -11494,7 +11494,7 @@ PyObject *ExecutiveGetBondSetting(PyMOLGlobals * G, int index, (SelectorIsMember(G, ai2->selEntry, sele1) && SelectorIsMember(G, ai1->selEntry, sele2))) { PyObject *pyBondInfo = PyList_New(3); - PyObject *bond_setting_value = NULL; + PyObject *bond_setting_value = nullptr; if (!pyObjList){ pyObjList = PyList_New(2); pyBondList = PyList_New(0); @@ -11537,8 +11537,8 @@ int ExecutiveSetBondSetting(PyMOLGlobals * G, int index, PyObject * tuple, #else CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; int sele1, sele2; SettingName name = ""; int unblock; @@ -11589,7 +11589,7 @@ int ExecutiveSetBondSetting(PyMOLGlobals * G, int index, PyObject * tuple, break; } if(have_value) { - rec = NULL; + rec = nullptr; while((ListIterate(I->Spec, rec, next))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule)) { obj = (ObjectMolecule *) rec->obj; @@ -11655,8 +11655,8 @@ int ExecutiveUnsetBondSetting(PyMOLGlobals * G, int index, const char *s1, const int state, int quiet, int updates) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; SettingName name; /* int unblock; */ int ok = true; @@ -11668,7 +11668,7 @@ int ExecutiveUnsetBondSetting(PyMOLGlobals * G, int index, const char *s1, const sele1 = SelectorIndexByName(G, s1); sele2 = SelectorIndexByName(G, s2); if((sele1 >= 0) && (sele2 >= 0)) { - rec = NULL; + rec = nullptr; while((ListIterate(I->Spec, rec, next))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule)) { obj = (ObjectMolecule *) rec->obj; @@ -11722,8 +11722,8 @@ pymol::Result<> ExecutiveSetSetting(PyMOLGlobals * G, int index, PyObject * tupl #else CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; int sele1; ObjectMoleculeOpRec op; OrthoLineType value; @@ -11752,16 +11752,16 @@ pymol::Result<> ExecutiveSetSetting(PyMOLGlobals * G, int index, PyObject * tupl pymol::pautoblock unblock(G); if((!sele) || (sele[0] == 0)) { /* global setting */ - ok = SettingSetFromTuple(G, NULL, index, tuple); + ok = SettingSetFromTuple(G, nullptr, index, tuple); if(ok) { if(!quiet) { if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, NULL, NULL, index, value); + SettingGetTextValue(G, nullptr, nullptr, index, value); PRINTF " Setting: %s set to %s.\n", name, value ENDF(G); } } if(updates) { - SettingGenerateSideEffects(G, index, NULL, state, quiet); + SettingGenerateSideEffects(G, index, nullptr, state, quiet); } } } @@ -11777,7 +11777,7 @@ pymol::Result<> ExecutiveSetSetting(PyMOLGlobals * G, int index, PyObject * tupl switch (rec->type) { case cExecAll: levelmask |= SettingLevelInfo[state < 0 ? cSettingLevel_object : cSettingLevel_ostate].mask; - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { { @@ -11794,7 +11794,7 @@ pymol::Result<> ExecutiveSetSetting(PyMOLGlobals * G, int index, PyObject * tupl } if(Feedback(G, FB_Setting, FB_Actions)) { if(nObj && handle) { - SettingGetTextValue(G, handle->get(), NULL, index, value); + SettingGetTextValue(G, handle->get(), nullptr, index, value); if(!quiet) { if(state < 0) { PRINTF @@ -11879,7 +11879,7 @@ pymol::Result<> ExecutiveSetSetting(PyMOLGlobals * G, int index, PyObject * tupl break; } if(have_atomic_value) { - rec = NULL; + rec = nullptr; while((ListIterate(I->Spec, rec, next))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule)) { obj = (ObjectMolecule *) rec->obj; @@ -11913,14 +11913,14 @@ pymol::Result<> ExecutiveSetSetting(PyMOLGlobals * G, int index, PyObject * tupl if(!quiet) { if(state < 0) { /* object-specific */ if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, handle->get(), NULL, index, value); + SettingGetTextValue(G, handle->get(), nullptr, index, value); PRINTF " Setting: %s set to %s in object \"%s\".\n", name, value, rec->obj->Name ENDF(G); } } else { /* state-specific */ if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, handle->get(), NULL, index, value); + SettingGetTextValue(G, handle->get(), nullptr, index, value); PRINTF " Setting: %s set to %s in object \"%s\", state %d.\n", name, value, rec->obj->Name, state + 1 ENDF(G); @@ -11961,8 +11961,8 @@ int ExecutiveGetSettingFromString(PyMOLGlobals * G, PyMOLreturn_value *result, int index, const char *sele, int state, int quiet) { - pymol::CObject *obj = NULL; - CSetting *set_ptr1 = NULL, *set_ptr2 = NULL; + pymol::CObject *obj = nullptr; + CSetting *set_ptr1 = nullptr, *set_ptr2 = nullptr; pymol::copyable_ptr* handle = nullptr; int ok = true; int type; @@ -12051,8 +12051,8 @@ int ExecutiveSetSettingFromString(PyMOLGlobals * G, int state, int quiet, int updates) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; int sele1; ObjectMoleculeOpRec op; OrthoLineType value2; @@ -12064,11 +12064,11 @@ int ExecutiveSetSettingFromString(PyMOLGlobals * G, PRINTFD(G, FB_Executive) " %s: entered. sele \"%s\"\n", __func__, sele ENDFD; if(sele[0] == 0) { /* global setting */ - ok = SettingSetFromString(G, NULL, index, value); + ok = SettingSetFromString(G, nullptr, index, value); if(ok) { if(!quiet) { if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, NULL, NULL, index, value2); + SettingGetTextValue(G, nullptr, nullptr, index, value2); SettingGetName(G, index, name); PRINTF " Setting: %s set to %s.\n", name, value2 ENDF(G); } @@ -12085,7 +12085,7 @@ int ExecutiveSetSettingFromString(PyMOLGlobals * G, if(rec) { switch (rec->type) { case cExecAll: - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { { @@ -12102,7 +12102,7 @@ int ExecutiveSetSettingFromString(PyMOLGlobals * G, } if(Feedback(G, FB_Setting, FB_Actions)) { if(nObj && handle) { - SettingGetTextValue(G, handle->get(), NULL, index, value2); + SettingGetTextValue(G, handle->get(), nullptr, index, value2); SettingGetName(G, index, name); if(!quiet) { if(state < 0) { @@ -12130,7 +12130,7 @@ int ExecutiveSetSettingFromString(PyMOLGlobals * G, op.i1 = index; op.i2 = type; op.ii1 = &value_store; - rec = NULL; + rec = nullptr; while((ListIterate(I->Spec, rec, next))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule)) { obj = (ObjectMolecule *) rec->obj; @@ -12163,7 +12163,7 @@ int ExecutiveSetSettingFromString(PyMOLGlobals * G, if(!quiet) { if(state < 0) { /* object-specific */ if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, handle->get(), NULL, index, value2); + SettingGetTextValue(G, handle->get(), nullptr, index, value2); SettingGetName(G, index, name); PRINTF " Setting: %s set to %s in object \"%s\".\n", @@ -12171,7 +12171,7 @@ int ExecutiveSetSettingFromString(PyMOLGlobals * G, } } else { /* state-specific */ if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, handle->get(), NULL, index, value2); + SettingGetTextValue(G, handle->get(), nullptr, index, value2); SettingGetName(G, index, name); PRINTF " Setting: %s set to %s in object \"%s\", state %d.\n", @@ -12204,11 +12204,11 @@ int ExecutiveSetObjSettingFromString(PyMOLGlobals * G, PRINTFD(G, FB_Executive) " ExecutiveSetObjSettingFromString: entered \n" ENDFD; if(!obj) { /* global */ - ok = SettingSetFromString(G, NULL, index, value); + ok = SettingSetFromString(G, nullptr, index, value); if(ok) { if(!quiet) { if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, NULL, NULL, index, value2); + SettingGetTextValue(G, nullptr, nullptr, index, value2); SettingGetName(G, index, name); PRINTF " Setting: %s set to %s.\n", name, value2 ENDF(G); } @@ -12228,7 +12228,7 @@ int ExecutiveSetObjSettingFromString(PyMOLGlobals * G, if(!quiet) { if(state < 0) { /* object-specific */ if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, handle->get(), NULL, index, value2); + SettingGetTextValue(G, handle->get(), nullptr, index, value2); SettingGetName(G, index, name); PRINTF " Setting: %s set to %s in object \"%s\".\n", @@ -12236,7 +12236,7 @@ int ExecutiveSetObjSettingFromString(PyMOLGlobals * G, } } else { /* state-specific */ if(Feedback(G, FB_Setting, FB_Actions)) { - SettingGetTextValue(G, handle->get(), NULL, index, value2); + SettingGetTextValue(G, handle->get(), nullptr, index, value2); SettingGetName(G, index, name); PRINTF " Setting: %s set to %s in object \"%s\", state %d.\n", @@ -12266,8 +12266,8 @@ pymol::Result<> ExecutiveUnsetSetting(PyMOLGlobals * G, int index, pymol::zstrin int state, int quiet, int updates) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; int sele1; ObjectMoleculeOpRec op; pymol::copyable_ptr* handle = nullptr; @@ -12301,7 +12301,7 @@ pymol::Result<> ExecutiveUnsetSetting(PyMOLGlobals * G, int index, pymol::zstrin if(rec) { switch (rec->type) { case cExecAll: - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { { @@ -12340,9 +12340,9 @@ pymol::Result<> ExecutiveUnsetSetting(PyMOLGlobals * G, int index, pymol::zstrin op.code = OMOP_SetAtomicSetting; op.i1 = index; op.i2 = cSetting_blank; - op.ii1 = NULL; + op.ii1 = nullptr; - rec = NULL; + rec = nullptr; while((ListIterate(I->Spec, rec, next))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectMolecule)) { obj = (ObjectMolecule *) rec->obj; @@ -12422,7 +12422,7 @@ pymol::Result<> ExecutiveColor( return pymol::Error("Unknown color."); } else { CTracker *I_Tracker = I->Tracker; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int n_atm = 0; int n_obj = 0; @@ -12468,7 +12468,7 @@ pymol::Result<> ExecutiveColor( SceneInvalidate(G); break; case cExecAll: - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { rec->obj->Color = col_ind; @@ -12517,7 +12517,7 @@ const char *ExecutiveFindBestNameMatch(PyMOLGlobals * G, const char *name) { const char *result; CExecutive *I = G->Executive; - SpecRec *rec = NULL, *best_rec = NULL; + SpecRec *rec = nullptr, *best_rec = nullptr; int best; int wm; auto ignore_case = SettingGet(G, cSetting_ignore_case); @@ -12547,7 +12547,7 @@ static int count_objects(PyMOLGlobals * G, int public_only) { int count = 0; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { if(!public_only) @@ -12562,7 +12562,7 @@ static int count_objects(PyMOLGlobals * G, int public_only) SpecRec* ExecutiveFindSpec(PyMOLGlobals* G, pymol::zstring_view name_view) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; const char* name = name_view.c_str(); // ignore % prefix if(name[0] && name[0] == '%') @@ -12574,7 +12574,7 @@ SpecRec* ExecutiveFindSpec(PyMOLGlobals* G, pymol::zstring_view name_view) if (keyRes != I->Key.end()) { if (!TrackerGetCandRef( I->Tracker, keyRes->second, (TrackerRef**) (void*) &rec)) { - rec = NULL; + rec = nullptr; } } } @@ -12590,8 +12590,8 @@ SpecRec* ExecutiveFindSpec(PyMOLGlobals* G, pymol::zstring_view name_view) bool ExecutiveObjMolSeleOp(PyMOLGlobals * G, int sele, ObjectMoleculeOpRec * op) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; - ObjectMolecule *obj = NULL; + SpecRec *rec = nullptr; + ObjectMolecule *obj = nullptr; int update_table = true; /* if we're given a valid selection */ @@ -12800,7 +12800,7 @@ int ExecutiveGetExtent(PyMOLGlobals * G, const char *name, float *mn, float *mx, auto* rec = &recref; switch (rec->type) { case cExecAll: - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { obj = rec->obj; @@ -12979,7 +12979,7 @@ static int ExecutiveGetMaxDistance(PyMOLGlobals * G, const char *name, float *po auto* rec = &recref; switch (rec->type) { case cExecAll: - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { obj = rec->obj; @@ -13175,7 +13175,7 @@ pymol::Result<> ExecutiveOrigin(PyMOLGlobals* G, const char* sele, int preserve, float center[3]; float mn[3], mx[3]; - pymol::CObject *obj = NULL; + pymol::CObject *obj = nullptr; int have_center = false; if(oname && oname[0]) { obj = ExecutiveFindObjectByName(G, oname); @@ -13302,7 +13302,7 @@ ExecutiveSetObjVisib(PyMOLGlobals * G, pymol::zstring_view name, int onoff, int SettingGet(G, cSetting_hide_underscore_names); if (suppress_hidden && hide_underscore) ExecutiveUpdateGroups(G, false); - SpecRec *tRec = NULL; + SpecRec *tRec = nullptr; while(ListIterate(I->Spec, tRec, next)) { if(onoff != tRec->visible) { if(tRec->type == cExecObject) { @@ -13556,7 +13556,7 @@ ExecutiveSetRepVisMask(PyMOLGlobals * G, pymol::zstring_view name, int repmask, { CExecutive *I = G->Executive; CTracker *I_Tracker = I->Tracker; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int list_id = ExecutiveGetNamesListFromPattern(G, name.data(), true, true); int iter_id = TrackerNewIter(I_Tracker, 0, list_id); while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &rec)) { @@ -13650,7 +13650,7 @@ static void ExecutiveSetAllRepVisMask(PyMOLGlobals * G, int repmask, int state) int sele; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; PRINTFD(G, FB_Executive) " ExecutiveSetAllRepVisib: entered.\n" ENDFD; while(ListIterate(I->Spec, rec, next)) { @@ -13693,7 +13693,7 @@ pymol::Result<> ExecutiveInvalidateRep( { CExecutive *I = G->Executive; ObjectMoleculeOpRec op; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; const char* name = ""; SelectorTmp2 s1; @@ -13730,7 +13730,7 @@ pymol::Result<> ExecutiveInvalidateRep( } break; case cExecAll: - rec = NULL; + rec = nullptr; while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) { rec->obj->invalidate(rep, level, -1); @@ -13754,7 +13754,7 @@ int ExecutiveCheckGroupMembership(PyMOLGlobals * G, int list_id, pymol::CObject CTracker *I_Tracker = I->Tracker; int iter_id = TrackerNewIter(I_Tracker, 0, list_id); if(iter_id) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &rec)) { if(rec && (rec->type == cExecObject) && (rec->obj == obj)) { result = true; @@ -13789,7 +13789,7 @@ int ExecutiveGetExpandedGroupListFromPattern(PyMOLGlobals * G, const char *name) if(WordMatcherMatchAlpha(matcher, rec->name)) { if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) { if(!result) - result = TrackerNewList(I_Tracker, NULL); + result = TrackerNewList(I_Tracker, nullptr); if(result) { TrackerLink(I_Tracker, cand_id, result, 1); } @@ -13800,12 +13800,12 @@ int ExecutiveGetExpandedGroupListFromPattern(PyMOLGlobals * G, const char *name) } } else if((rec = ExecutiveFindSpec(G, name))) { /* only one name in list */ if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) { - result = TrackerNewList(I_Tracker, NULL); + result = TrackerNewList(I_Tracker, nullptr); TrackerLink(I_Tracker, rec->cand_id, result, 1); } } else if((rec = ExecutiveUnambiguousNameMatch(G, name))) { if((rec->type == cExecObject) && (rec->obj->type == cObjectGroup)) { - result = TrackerNewList(I_Tracker, NULL); + result = TrackerNewList(I_Tracker, nullptr); TrackerLink(I_Tracker, rec->cand_id, result, 1); } } @@ -13830,7 +13830,7 @@ int ExecutiveGetExpandedGroupList(PyMOLGlobals * G, const char *name) list_id = rec->group_member_list_id; } if(list_id) { - result = TrackerNewListCopy(I->Tracker, list_id, NULL); + result = TrackerNewListCopy(I->Tracker, list_id, nullptr); ExecutiveExpandGroupsInList(G, result, cExecExpandGroups); } return result; @@ -13846,7 +13846,7 @@ void ExecutiveFreeGroupList(PyMOLGlobals * G, int list_id) /*========================================================================*/ pymol::CObject *ExecutiveFindObjectByName(PyMOLGlobals * G, pymol::zstring_view name) { - pymol::CObject *obj = NULL; + pymol::CObject *obj = nullptr; SpecRec *rec = ExecutiveFindSpec(G, name.c_str()); if(rec && (rec->type == cExecObject)) { obj = rec->obj; @@ -13855,10 +13855,10 @@ pymol::CObject *ExecutiveFindObjectByName(PyMOLGlobals * G, pymol::zstring_view } /*========================================================================*/ -/* returns NULL if none found */ +/* returns nullptr if none found */ pymol::CObject ** ExecutiveFindObjectsByType(PyMOLGlobals * G, int objType) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int n = 0; pymol::CObject** rVal = VLAlloc(pymol::CObject*, 1); @@ -13877,7 +13877,7 @@ pymol::CObject ** ExecutiveFindObjectsByType(PyMOLGlobals * G, int objType) { VLASize(rVal, pymol::CObject*, n); if (n==0) { VLAFree(rVal); - return NULL; + return nullptr; } else return rVal; @@ -14011,9 +14011,9 @@ void ExecutiveSymExp(PyMOLGlobals * G, const char *name, } auto map = - std::unique_ptr(MapNew(G, -cutoff, vv1.data(), op.nvv1, NULL)); + std::unique_ptr(MapNew(G, -cutoff, vv1.data(), op.nvv1, nullptr)); if (!map) { - ErrMessage(G, __func__, "map is NULL"); + ErrMessage(G, __func__, "map is nullptr"); return; } @@ -14145,7 +14145,7 @@ void ExecutivePurgeSpec(PyMOLGlobals * G, SpecRec * rec, bool save) switch (rec->type) { case cExecObject: if(I->LastEdited == rec->obj) - I->LastEdited = NULL; + I->LastEdited = nullptr; if(rec->obj->type == cObjectMolecule) if(EditorIsAnActiveObject(G, (ObjectMolecule *) rec->obj)) EditorInactivate(G); @@ -14225,7 +14225,7 @@ pymol::Result> ExecutiveDelete(PyMOLGlobals * G, pymol } }; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CTracker *I_Tracker = I->Tracker; int list_id = ExecutiveGetNamesListFromPattern(G, name, false, false); int iter_id = TrackerNewIter(I_Tracker, 0, list_id); @@ -14293,7 +14293,7 @@ void ExecutiveReAddSpec(PyMOLGlobals* G, std::vector& specs) /*========================================================================*/ void ExecutiveDump(PyMOLGlobals * G, const char *fname, const char *obj, int state, int quiet) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; SceneUpdate(G, false); @@ -14381,7 +14381,7 @@ static void ExecutiveDoAutoGroup(PyMOLGlobals * G, SpecRec * rec) if(auto_mode && (rec->name[0] != '_')) { auto ignore_case = SettingGet(G, cSetting_ignore_case); char *period = rec->name + strlen(rec->name); - SpecRec *found_group = NULL; + SpecRec *found_group = nullptr; WordType seek_group_name; UtilNCopy(seek_group_name, rec->name, sizeof(WordType)); @@ -14390,7 +14390,7 @@ static void ExecutiveDoAutoGroup(PyMOLGlobals * G, SpecRec * rec) if(*period == '.') { seek_group_name[period - rec->name] = 0; { - SpecRec *group_rec = NULL; + SpecRec *group_rec = nullptr; while(ListIterate(I->Spec, group_rec, next)) { if((group_rec->type == cExecObject) && (group_rec->obj->type == cObjectGroup)) { if(WordMatchExact(G, group_rec->name, seek_group_name, ignore_case)) { @@ -14441,7 +14441,7 @@ static void ExecutiveDoAutoGroup(PyMOLGlobals * G, SpecRec * rec) */ void ExecutiveManageObject(PyMOLGlobals * G, pymol::CObject * obj, int zoom, int quiet) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; int exists = false; int previousVisible; @@ -14529,7 +14529,7 @@ void ExecutiveManageObject(PyMOLGlobals * G, pymol::CObject * obj, int zoom, int if(obj->type == cObjectMolecule) { ObjectMolecule *objMol = (ObjectMolecule *) obj; if(objMol->NCSet == 1) { - ExecutiveAssignSS(G, obj->Name, 0, NULL, true, objMol, true); + ExecutiveAssignSS(G, obj->Name, 0, nullptr, true, objMol, true); } } } @@ -14576,7 +14576,7 @@ void ExecutiveManageSelection(PyMOLGlobals * G, const char *name) ListElemCalloc(G, rec, SpecRec); strcpy(rec->name, name); rec->type = cExecSelection; - rec->next = NULL; + rec->next = nullptr; rec->sele_color = -1; assert(!rec->visible); rec->cand_id = TrackerNewCand(I->Tracker, (TrackerRef *) (void *) rec); @@ -14606,7 +14606,7 @@ int CExecutive::click(int button, int x, int y, int mod) PyMOLGlobals *G = m_G; CExecutive *I = G->Executive; int n, a; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int t, xx; int pass = false; int skip; @@ -14643,7 +14643,7 @@ int CExecutive::click(int button, int x, int y, int mod) } skip = I->NSkip; if(!pass) { - I->RecoverPressed = NULL; + I->RecoverPressed = nullptr; /* while(ListIterate(I->Spec,rec,next)) { */ for (auto& panelitem : I->Panel) { auto* const panel = &panelitem; @@ -14903,8 +14903,8 @@ int CExecutive::click(int button, int x, int y, int mod) I->Over = n; I->DragMode = ExecutiveDragMode::Visibility; I->ToggleMode = ExecutiveToggleMode::DeferVisibility; - I->LastChanged = NULL; - I->LastZoomed = NULL; + I->LastChanged = nullptr; + I->LastZoomed = nullptr; if(mod == (cOrthoSHIFT | cOrthoCTRL)) { I->ToggleMode = ExecutiveToggleMode::HoverActivate; if(!rec->visible) { @@ -14938,7 +14938,7 @@ int CExecutive::click(int button, int x, int y, int mod) I->DragMode = ExecutiveDragMode::VisibilityWithCamera; I->ToggleMode = ExecutiveToggleMode::DeferVisibility; I->LastChanged = rec; - I->LastZoomed = NULL; + I->LastZoomed = nullptr; if(mod & cOrthoCTRL) { I->ToggleMode = ExecutiveToggleMode::ZoomActivateDeactivatePrevious; ExecutiveWindowZoom(G, rec->name, 0.0F, -1, false, -1.0F, true); @@ -14952,7 +14952,7 @@ int CExecutive::click(int button, int x, int y, int mod) } } else { I->ToggleMode = ExecutiveToggleMode::CenterActivateDeactivatePrevious; - ExecutiveCenter(G, rec->name, -1, true, -1.0F, NULL, true); + ExecutiveCenter(G, rec->name, -1, true, -1.0F, nullptr, true); } if(!rec->visible) { ExecutiveSpecSetVisibility(G, rec, !rec->visible, mod, false); @@ -15023,7 +15023,7 @@ static void ExecutiveSpecEnable(PyMOLGlobals * G, SpecRec * rec, int parents, in int list_id = ExecutiveGetObjectParentList(G, rec); if(list_id) { int iter_id = TrackerNewIter(I_Tracker, 0, list_id); - SpecRec *parent_rec = NULL; + SpecRec *parent_rec = nullptr; while(TrackerIterNextCandInList(I_Tracker, iter_id, (TrackerRef **) (void *) &parent_rec)) { @@ -15136,7 +15136,7 @@ int CExecutive::release(int button, int x, int y, int mod) { PyMOLGlobals *G = m_G; CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int pass = false; int skip; int xx; @@ -15213,7 +15213,7 @@ int CExecutive::release(int button, int x, int y, int mod) } { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) { rec->hilight = 0; } @@ -15265,14 +15265,14 @@ int CExecutive::drag(int x, int y, int mod) I->Over = -1; row_offset = -1; { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; while(ListIterate(I->Spec, rec, next)) rec->hilight = 0; } } if(I->RecoverPressed) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int skip = I->NSkip; int row = 0; for (auto& panelitem : I->Panel) { @@ -15286,7 +15286,7 @@ int CExecutive::drag(int x, int y, int mod) } else { if(rec == I->RecoverPressed) { I->Pressed = row; - I->RecoverPressed = NULL; + I->RecoverPressed = nullptr; } row++; } @@ -15298,7 +15298,7 @@ int CExecutive::drag(int x, int y, int mod) I->OverWhat = 0; } if(I->Over >= 0) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; int skip = I->NSkip; int row = 0; switch (I->DragMode) { @@ -15375,8 +15375,8 @@ int CExecutive::drag(int x, int y, int mod) case ExecutiveDragMode::Reorder: /* right buttonBROKEN */ { if((I->Over != I->Pressed) && (I->LastOver != I->Over)) { - SpecRec *new_rec = NULL; - SpecRec *mov_rec = NULL; + SpecRec *new_rec = nullptr; + SpecRec *mov_rec = nullptr; for (auto& panelitem : I->Panel) { rec = panelitem.spec; @@ -15401,7 +15401,7 @@ int CExecutive::drag(int x, int y, int mod) int group_flag = false; int order_flag = false; int location = 0; - char *first = NULL, *second = NULL; + char *first = nullptr, *second = nullptr; int is_child = false; if(mov_rec && (!new_rec) && (I->Over > I->Pressed) && mov_rec->group) { @@ -15512,7 +15512,7 @@ int CExecutive::drag(int x, int y, int mod) if((row == I->Over) && row) { if(I->LastChanged != rec) { ExecutiveSpecSetVisibility(G, I->LastChanged, false, mod, false); - ExecutiveCenter(G, rec->name, -1, true, -1.0F, NULL, true); + ExecutiveCenter(G, rec->name, -1, true, -1.0F, nullptr, true); if(!rec->visible) ExecutiveSpecSetVisibility(G, rec, true, mod, false); I->LastChanged = rec; @@ -15655,7 +15655,7 @@ static void draw_button_char(PyMOLGlobals * G, int x2, int y2, char ch , CGO *or /** * Get the text color for the object name. - * @param obj Object pointer, may be NULL + * @param obj Object pointer, may be nullptr * @param mode 0: default, 1: first carbon atom color, 2: object color * @param bg_rgb Background color * @param default_rgb Default text color @@ -15716,7 +15716,7 @@ void CExecutive::draw(CGO* orthoCGO) PyMOLGlobals *G = m_G; int x, y, xx, x2, y2; WordType ch; - char *c = NULL; + char *c = nullptr; float enabledColor[3] = { 0.5F, 0.5F, 0.5F }; float cloakedColor[3] = { 0.35F, 0.35F, 0.35F }; float pressedColor[3] = { 0.7F, 0.7F, 0.7F }; @@ -15730,7 +15730,7 @@ void CExecutive::draw(CGO* orthoCGO) float toggleColor3[3] = { 0.6F, 0.6F, 0.8F }; #endif - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CExecutive *I = G->Executive; int n_ent; int n_disp; @@ -15902,7 +15902,7 @@ void CExecutive::draw(CGO* orthoCGO) break; case 4: draw_button(x2, y2, ExecToggleSize, (ExecLineHeight - 1), - toggleLightEdge, toggleDarkEdge, NULL, orthoCGO); + toggleLightEdge, toggleDarkEdge, nullptr, orthoCGO); draw_button_char(G, x2, y2 + text_lift, 'C', orthoCGO); break; case 5: @@ -16112,8 +16112,8 @@ int ExecutiveIterateObject(PyMOLGlobals * G, pymol::CObject ** obj, void **hidde if(*rec) (*obj) = (*rec)->obj; else - (*obj) = NULL; - return ((*rec) != NULL); + (*obj) = nullptr; + return ((*rec) != nullptr); } @@ -16128,8 +16128,8 @@ int ExecutiveIterateObjectMolecule(PyMOLGlobals * G, ObjectMolecule ** obj, void if(*rec) (*obj) = (ObjectMolecule *) (*rec)->obj; else - (*obj) = NULL; - return ((*rec) != NULL); + (*obj) = nullptr; + return ((*rec) != nullptr); } @@ -16157,10 +16157,10 @@ pymol::Result<> ExecutiveReinitialize(PyMOLGlobals * G, int what, pymol::zstring /* reinitialize PyMOL */ const char* pattern = inPattern.data(); if(what == 2) - pattern = NULL; + pattern = nullptr; if(pattern && (!pattern[0])) - pattern = NULL; + pattern = nullptr; if(!pattern) { switch (what) { @@ -16179,7 +16179,7 @@ pymol::Result<> ExecutiveReinitialize(PyMOLGlobals * G, int what, pymol::zstring blocked = PAutoBlock(G); PRunStringInstance(G, "cmd.view('*','clear')"); PRunStringInstance(G, "cmd.config_mouse(\"three_button\")"); - WizardSet(G, NULL, false); + WizardSet(G, nullptr, false); PAutoUnblock(G, blocked); #endif @@ -16206,8 +16206,8 @@ pymol::Result<> ExecutiveReinitialize(PyMOLGlobals * G, int what, pymol::zstring case 5: case 6: if (G->Default){ - SettingSetGlobal_i(G, cSetting_internal_gui, SettingGet_i(G, G->Default, NULL, cSetting_internal_gui)); - SettingGenerateSideEffects(G, cSetting_internal_gui, NULL, -1, 0); + SettingSetGlobal_i(G, cSetting_internal_gui, SettingGet_i(G, G->Default, nullptr, cSetting_internal_gui)); + SettingGenerateSideEffects(G, cSetting_internal_gui, nullptr, -1, 0); } break; } @@ -16251,16 +16251,16 @@ pymol::Result<> ExecutiveReinitialize(PyMOLGlobals * G, int what, pymol::zstring /*========================================================================*/ int ExecutiveInit(PyMOLGlobals * G) { - CExecutive *I = NULL; + CExecutive *I = nullptr; if((I = (G->Executive = new CExecutive(G)))) { - SpecRec *rec = NULL; + SpecRec *rec = nullptr; ListInit(I->Spec); I->Tracker = TrackerNew(G); - I->all_names_list_id = TrackerNewList(I->Tracker, NULL); - I->all_obj_list_id = TrackerNewList(I->Tracker, NULL); - I->all_sel_list_id = TrackerNewList(I->Tracker, NULL); + I->all_names_list_id = TrackerNewList(I->Tracker, nullptr); + I->all_obj_list_id = TrackerNewList(I->Tracker, nullptr); + I->all_sel_list_id = TrackerNewList(I->Tracker, nullptr); I->active = true; OrthoAttach(G, I, cOrthoTool); #ifndef GLUT_FULL_SCREEN @@ -16277,7 +16277,7 @@ int ExecutiveInit(PyMOLGlobals * G) strcpy(rec->name, cKeywordAll); rec->type = cExecAll; rec->visible = true; - rec->next = NULL; + rec->next = nullptr; rec->cand_id = TrackerNewCand(I->Tracker, (TrackerRef *) (void *) rec); TrackerLink(I->Tracker, rec->cand_id, I->all_names_list_id, 1); ListAppend(I->Spec, rec, next, SpecRec); @@ -16294,7 +16294,7 @@ int ExecutiveInit(PyMOLGlobals * G) void ExecutiveFree(PyMOLGlobals * G) { CExecutive *I = G->Executive; - SpecRec *rec = NULL; + SpecRec *rec = nullptr; CGOFree(I->selIndicatorsCGO); while(ListIterate(I->Spec, rec, next)) { if(rec->type == cExecObject) @@ -16392,14 +16392,14 @@ printf("\n"); PyObject * ExecutiveCEAlign(PyMOLGlobals * G, PyObject * listA, PyObject * listB, int lenA, int lenB, float d0, float d1, int windowSize, int gapMax) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else int i=0; int smaller; double **dmA ,**dmB, **S; int bufferSize; pcePoint coordsA, coordsB; - pathCache paths = NULL; + pathCache paths = nullptr; PyObject * result; smaller = lenA < lenB ? lenA : lenB; @@ -16482,7 +16482,7 @@ char *ExecutiveGetObjectNames(PyMOLGlobals * G, int mode, const char *name, int } if (!size){ VLAFreeP(res); - res = NULL; + res = nullptr; } else { VLASize(res, char, size); } @@ -16491,17 +16491,17 @@ char *ExecutiveGetObjectNames(PyMOLGlobals * G, int mode, const char *name, int /** * Get the coord set for the given object name and state index. If "omp" is - * not NULL, then also store a pointer to the object molecule. + * not nullptr, then also store a pointer to the object molecule. */ CoordSet * ExecutiveGetCoordSet(PyMOLGlobals * G, const char * name, int state, ObjectMolecule ** omp) { - ObjectMolecule * om = NULL; - CoordSet * cs = NULL; + ObjectMolecule * om = nullptr; + CoordSet * cs = nullptr; ok_assert(1, om = ExecutiveFindObject(G, name)); ok_assert(1, cs = om->getCoordSet(state)); ok_except1: - if (omp != NULL) + if (omp != nullptr) *omp = om; return cs; } @@ -16556,7 +16556,7 @@ pymol::Result<> ExecutiveSliceNew(PyMOLGlobals* G, const char* slice_name, const char* map_name, int state, int map_state) { int multi = false; - pymol::CObject *obj = NULL, *mObj, *origObj; + pymol::CObject *obj = nullptr, *mObj, *origObj; ObjectMap *mapObj; ObjectMapState *ms; @@ -16570,7 +16570,7 @@ pymol::Result<> ExecutiveSliceNew(PyMOLGlobals* G, const char* slice_name, mObj = ExecutiveFindObjectByName(G, map_name); if(mObj) { if(mObj->type != cObjectMap) - mObj = NULL; + mObj = nullptr; } if(mObj) { mapObj = (ObjectMap *) mObj; diff --git a/layer3/Executive.h b/layer3/Executive.h index 4491a47d7..9343bb8ce 100644 --- a/layer3/Executive.h +++ b/layer3/Executive.h @@ -325,7 +325,7 @@ pymol::CObject* ExecutiveFindObjectByName( /** * Typed version of `ExecutiveFindObjectByName` * @param name Object name - * @return NULL if object can't be found or has the wrong type + * @return nullptr if object can't be found or has the wrong type */ template T* ExecutiveFindObject(PyMOLGlobals* G, pymol::zstring_view name) { diff --git a/layer3/ExecutivePython.cpp b/layer3/ExecutivePython.cpp index 7ba970990..84df6d0d3 100644 --- a/layer3/ExecutivePython.cpp +++ b/layer3/ExecutivePython.cpp @@ -13,7 +13,7 @@ pymol::Result<> ExecutiveLoadObject(PyMOLGlobals* G, int discrete, int quiet, int zoom) { ObjectNameType valid_name = ""; - pymol::CObject *origObj = NULL, *obj; + pymol::CObject *origObj = nullptr, *obj; OrthoLineType buf; buf[0] = 0; ExecutiveProcessObjectName(G, oname, valid_name); @@ -27,7 +27,7 @@ pymol::Result<> ExecutiveLoadObject(PyMOLGlobals* G, if (origObj) { if (origObj->type != cObjectMolecule) { ExecutiveDelete(G, valid_name); - origObj = NULL; + origObj = nullptr; } } PBlock(G); /*PBlockAndUnlockAPI(); */ @@ -59,7 +59,7 @@ pymol::Result<> ExecutiveLoadObject(PyMOLGlobals* G, if (origObj) if (origObj->type != cObjectMap) { ExecutiveDelete(G, valid_name); - origObj = NULL; + origObj = nullptr; } PBlock(G); /*PBlockAndUnlockAPI(); */ obj = ObjectMapLoadChemPyBrick( @@ -81,7 +81,7 @@ pymol::Result<> ExecutiveLoadObject(PyMOLGlobals* G, if (origObj) if (origObj->type != cObjectMap) { ExecutiveDelete(G, valid_name); - origObj = NULL; + origObj = nullptr; } PBlock(G); /*PBlockAndUnlockAPI(); */ obj = ObjectMapLoadChemPyMap( @@ -103,7 +103,7 @@ pymol::Result<> ExecutiveLoadObject(PyMOLGlobals* G, if (origObj) if (origObj->type != cObjectCallback) { ExecutiveDelete(G, valid_name); - origObj = NULL; + origObj = nullptr; } PBlock(G); /*PBlockAndUnlockAPI(); */ obj = ObjectCallbackDefine( @@ -125,7 +125,7 @@ pymol::Result<> ExecutiveLoadObject(PyMOLGlobals* G, if (origObj) if (origObj->type != cObjectCGO) { ExecutiveDelete(G, valid_name); - origObj = NULL; + origObj = nullptr; } PBlock(G); /*PBlockAndUnlockAPI(); */ obj = ObjectCGODefine(G, (ObjectCGO*) origObj, model, frame); diff --git a/layer3/Interactions.cpp b/layer3/Interactions.cpp index b79d45585..9828c406d 100644 --- a/layer3/Interactions.cpp +++ b/layer3/Interactions.cpp @@ -254,7 +254,7 @@ namespace pymol /** * Find pi-pi and/or pi-cation interactions. * - * @param ds Measurement state to update, or NULL to create a new one. + * @param ds Measurement state to update, or nullptr to create a new one. * @param sele1 Selection index * @param state1 Object state * @param sele2 Selection index diff --git a/layer3/MoleculeExporter.cpp b/layer3/MoleculeExporter.cpp index 833a85920..fc9667287 100644 --- a/layer3/MoleculeExporter.cpp +++ b/layer3/MoleculeExporter.cpp @@ -477,7 +477,7 @@ struct MoleculeExporterPDB : public MoleculeExporter { /** * Write a TER record if the previous atom was polymer and `ai` - * is NULL, non-polymer, or has a different chain identifier. + * is nullptr, non-polymer, or has a different chain identifier. */ void writeTER(const AtomInfoType* ai) { if (!m_use_ter_records) @@ -1610,7 +1610,7 @@ class MoleculeExporterMMTF : public MoleculeExporter { /** * Export the given selection to a molecular file format. * - * @return File contents or NULL if the format is not known. + * @return File contents or nullptr if the format is not known. * * @param format pdb, sdf, ... * @param selection atom selection expression @@ -1765,7 +1765,7 @@ PyObject *MoleculeExporterGetPyBonds(PyMOLGlobals * G, * */ struct MoleculeExporterChemPy : public MoleculeExporter { - PyObject *m_model = nullptr; //!< Final result (never NULL) + PyObject *m_model = nullptr; //!< Final result (never nullptr) protected: int m_n_cs = 0; //!< Number of coordinate sets diff --git a/layer3/MovieScene.cpp b/layer3/MovieScene.cpp index 1504fd875..0d53d8ba7 100644 --- a/layer3/MovieScene.cpp +++ b/layer3/MovieScene.cpp @@ -520,7 +520,7 @@ pymol::Result<> MovieSceneRecall(PyMOLGlobals * G, const char * name, float anim * Rename or delete a scene * * @param name name to rename or delete, or "*" to delete all - * @param new_name new scene name to rename, or NULL to delete + * @param new_name new scene name to rename, or nullptr to delete */ pymol::Result<> MovieSceneRename(PyMOLGlobals * G, const char * name, const char * new_name) { @@ -818,7 +818,7 @@ static bool PConvFromPyObject(PyMOLGlobals * G, PyObject * obj, MovieScene &out) std::map atomdata_old_ids; if (!G) { - printf(" Error: G is NULL\n"); + printf(" Error: G is nullptr\n"); return false; } diff --git a/layer3/MovieScene.h b/layer3/MovieScene.h index 4af5d4fb3..6e0567dd7 100644 --- a/layer3/MovieScene.h +++ b/layer3/MovieScene.h @@ -138,7 +138,7 @@ pymol::Result<> MovieSceneDelete(PyMOLGlobals * G, const char * name, pymol::Result<> MovieSceneOrder(PyMOLGlobals * G, const char * names, bool sort = false, - const char * location = NULL /* "current" */); + const char * location = nullptr /* "current" */); pymol::Result<> MovieSceneOrder(PyMOLGlobals* G, std::vector names, bool sort = false, const char* location = nullptr); diff --git a/layer3/PlugIOManager.cpp b/layer3/PlugIOManager.cpp index ea8cc1d53..78b95a35b 100644 --- a/layer3/PlugIOManager.cpp +++ b/layer3/PlugIOManager.cpp @@ -74,7 +74,7 @@ ObjectMap *PlugIOManagerLoadVol(PyMOLGlobals * G, ObjectMap * obj, PRINTFB(G, FB_ObjectMolecule, FB_Errors) " ObjectMap-Error: sorry, VMD Molfile Plugins not compiled into this build.\n" ENDFB(G); - return NULL; + return nullptr; } ObjectMolecule *PlugIOManagerLoadMol(PyMOLGlobals * G, ObjectMolecule *origObj, @@ -157,7 +157,7 @@ int PlugIOManagerLoadTraj(PyMOLGlobals * G, ObjectMolecule * obj, const float *shift, int quiet, const char *plugin_type) { CPlugIOManager *I = G->PlugIOManager; - molfile_plugin_t *plugin = NULL; + molfile_plugin_t *plugin = nullptr; ok_assert(1, I && obj); plugin = find_plugin(I, plugin_type); @@ -168,7 +168,7 @@ int PlugIOManagerLoadTraj(PyMOLGlobals * G, ObjectMolecule * obj, return false; } - if(plugin->read_next_timestep == NULL) { + if(plugin->read_next_timestep == nullptr) { PRINTFB(G, FB_ObjectMolecule, FB_Errors) " PlugIOManager: not a trajectory plugin '%s'\n", plugin_type ENDFB(G); return false; @@ -189,10 +189,10 @@ int PlugIOManagerLoadTraj(PyMOLGlobals * G, ObjectMolecule * obj, int icnt = interval; int n_avg = 0; int ncnt = 0; - CoordSet *cs = obj->NCSet > 0 ? obj->CSet[0] : obj->CSTmpl ? obj->CSTmpl : NULL; + CoordSet *cs = obj->NCSet > 0 ? obj->CSet[0] : obj->CSTmpl ? obj->CSTmpl : nullptr; - timestep.coords = NULL; - timestep.velocities = NULL; + timestep.coords = nullptr; + timestep.velocities = nullptr; file_handle = plugin->open_file_read(fname, plugin_type, &natoms); @@ -299,7 +299,7 @@ int PlugIOManagerLoadTraj(PyMOLGlobals * G, ObjectMolecule * obj, cs->Symmetry.reset(SymmetryNewFromTimestep(G, ×tep)); if((stop > 0 && cnt >= stop) || (max > 0 && ncnt >= max)) { - cs = NULL; + cs = nullptr; break; } @@ -343,12 +343,12 @@ ObjectMap *PlugIOManagerLoadVol(PyMOLGlobals * G, ObjectMap * obj, const char *plugin_type) { CPlugIOManager *I = G->PlugIOManager; - molfile_plugin_t *plugin = NULL; + molfile_plugin_t *plugin = nullptr; molfile_volumetric_t *metadata; int setsinfile = 0; int natoms; - void *file_handle = NULL; - float *datablock = NULL; + void *file_handle = nullptr; + float *datablock = nullptr; ok_assert(1, I); plugin = find_plugin(I, plugin_type); @@ -359,7 +359,7 @@ ObjectMap *PlugIOManagerLoadVol(PyMOLGlobals * G, ObjectMap * obj, ok_raise(1); } - if(plugin->read_volumetric_data == NULL || plugin->read_volumetric_metadata == NULL) { + if(plugin->read_volumetric_data == nullptr || plugin->read_volumetric_metadata == nullptr) { PRINTFB(G, FB_ObjectMolecule, FB_Errors) " PlugIOManager: not a map plugin '%s'\n", plugin_type ENDFB(G); ok_raise(1); @@ -394,14 +394,14 @@ ObjectMap *PlugIOManagerLoadVol(PyMOLGlobals * G, ObjectMap * obj, ok_assert(1, datablock = pymol::malloc(size)); - if(plugin->read_volumetric_data(file_handle, i, datablock, NULL) != MOLFILE_SUCCESS) { + if(plugin->read_volumetric_data(file_handle, i, datablock, nullptr) != MOLFILE_SUCCESS) { PRINTFB(G, FB_ObjectMolecule, FB_Errors) " PlugIOManager: read_volumetric_data failed\n" ENDFB(G); ok_raise(1); } { - ObjectMapState *ms = NULL; + ObjectMapState *ms = nullptr; if(!obj) ok_assert(1, obj = new ObjectMap(G)); @@ -561,7 +561,7 @@ ObjectMap *PlugIOManagerLoadVol(PyMOLGlobals * G, ObjectMap * obj, static CSymmetry * SymmetryNewFromTimestep(PyMOLGlobals * G, molfile_timestep_t * ts) { - CSymmetry * symm = NULL; + CSymmetry * symm = nullptr; ok_assert(1, ts->A > 0.f && ts->B > 0.f && ts->C > 0.f && ts->alpha > 0.f && ts->beta > 0.f && ts->gamma > 0.f); @@ -579,12 +579,12 @@ ObjectMolecule *PlugIOManagerLoadMol(PyMOLGlobals * G, ObjectMolecule *origObj, int natoms, nbonds = 0, *from, *to; int optflags = 0; float *order; - void *file_handle = NULL; - molfile_plugin_t * plugin = NULL; + void *file_handle = nullptr; + molfile_plugin_t * plugin = nullptr; molfile_timestep_t timestep; - molfile_atom_t * atoms = NULL; - ObjectMolecule *I = NULL; - CoordSet * cs = NULL; + molfile_atom_t * atoms = nullptr; + ObjectMolecule *I = nullptr; + CoordSet * cs = nullptr; int *bondtype, nbondtypes; char **bondtypename; int auto_show = RepGetAutoShowMask(G); @@ -665,12 +665,12 @@ ObjectMolecule *PlugIOManagerLoadMol(PyMOLGlobals * G, ObjectMolecule *origObj, } // read coordinates - while (/* true */ plugin->read_next_timestep != NULL) { + while (/* true */ plugin->read_next_timestep != nullptr) { ok_assert(1, cs = CoordSetNew(G)); ok_assert(1, cs->Coord = pymol::vla(3 * natoms)); timestep.coords = cs->Coord.data(); - timestep.velocities = NULL; + timestep.velocities = nullptr; if (plugin->read_next_timestep(file_handle, natoms, ×tep) != MOLFILE_SUCCESS) { delete cs; @@ -760,13 +760,13 @@ ObjectCGO *PlugIOManagerLoadGraphics(PyMOLGlobals * G, ObjectCGO *origObj, const char *fname, int state, int quiet, const char *plugin_type) { CPlugIOManager *manager = G->PlugIOManager; - void *file_handle = NULL; - molfile_plugin_t * plugin = NULL; - const molfile_graphics_t * graphics = NULL; + void *file_handle = nullptr; + molfile_plugin_t * plugin = nullptr; + const molfile_graphics_t * graphics = nullptr; int nelem = 0; int beginend = 0; - CGO *cgo = NULL; - ObjectCGO *I = NULL; + CGO *cgo = nullptr; + ObjectCGO *I = nullptr; ok_assert(1, manager); plugin = find_plugin(manager, plugin_type); @@ -800,8 +800,8 @@ ObjectCGO *PlugIOManagerLoadGraphics(PyMOLGlobals * G, ObjectCGO *origObj, // translate to CGO for (auto g = graphics, g_end = graphics + nelem; g != g_end; ++g) { auto g_current = g; - const float * tnormals = NULL; - const float * tcolors = NULL; + const float * tnormals = nullptr; + const float * tcolors = nullptr; switch (g->type) { case MOLFILE_POINT: @@ -863,7 +863,7 @@ ObjectCGO *PlugIOManagerLoadGraphics(PyMOLGlobals * G, ObjectCGO *origObj, CGOStop(cgo); // Create ObjectCGO - ok_assert(1, I = ObjectCGOFromCGO(G, NULL, cgo, state)); + ok_assert(1, I = ObjectCGOFromCGO(G, nullptr, cgo, state)); // default is cgo_lighting=0 when loading CGOs without normals SettingSet(cSetting_cgo_lighting, 1, (pymol::CObject *)I); @@ -887,7 +887,7 @@ ObjectCGO *PlugIOManagerLoadGraphics(PyMOLGlobals * G, ObjectCGO *origObj, pymol::CObject * PlugIOManagerLoad(PyMOLGlobals * G, pymol::CObject ** obj_ptr, const char *fname, int state, int quiet, const char *plugin_type, int mask) { - pymol::CObject *obj = obj_ptr ? *obj_ptr : NULL; + pymol::CObject *obj = obj_ptr ? *obj_ptr : nullptr; CPlugIOManager *manager = G->PlugIOManager; molfile_plugin_t *plugin; @@ -897,7 +897,7 @@ pymol::CObject * PlugIOManagerLoad(PyMOLGlobals * G, pymol::CObject ** obj_ptr, if (!plugin) { PRINTFB(G, FB_ObjectMolecule, FB_Blather) " PlugIOManagerLoad: no plugin '%s'\n", plugin_type ENDFB(G); - return NULL; + return nullptr; } if (!mask) @@ -908,7 +908,7 @@ pymol::CObject * PlugIOManagerLoad(PyMOLGlobals * G, pymol::CObject ** obj_ptr, if (obj && obj->type != cObjectMap) { ExecutiveDelete(G, obj->Name); - obj = *obj_ptr = NULL; + obj = *obj_ptr = nullptr; } return PlugIOManagerLoadVol(G, (ObjectMap *) obj, @@ -925,7 +925,7 @@ pymol::CObject * PlugIOManagerLoad(PyMOLGlobals * G, pymol::CObject ** obj_ptr, #endif ) { ExecutiveDelete(G, obj->Name); - obj = *obj_ptr = NULL; + obj = *obj_ptr = nullptr; } return PlugIOManagerLoadMol(G, (ObjectMolecule *) obj, @@ -939,12 +939,12 @@ pymol::CObject * PlugIOManagerLoad(PyMOLGlobals * G, pymol::CObject ** obj_ptr, if (obj && obj->type != cObjectMolecule) { PRINTFB(G, FB_ObjectMolecule, FB_Errors) " PlugIOManagerLoad: can't load trajectory into object '%s'\n", obj->Name ENDFB(G); - return NULL; + return nullptr; } PlugIOManagerLoadTraj(G, (ObjectMolecule *) obj, fname, state, 1, 1, 1, -1, -1, "all", 1, shift, quiet, plugin_type); - return NULL; + return nullptr; } else if ((mask & cPlugIOManager_graphics) && plugin->read_rawgraphics) { // geometry (CGO) @@ -952,7 +952,7 @@ pymol::CObject * PlugIOManagerLoad(PyMOLGlobals * G, pymol::CObject ** obj_ptr, if (obj) { // no merge support ExecutiveDelete(G, obj->Name); - obj = *obj_ptr = NULL; + obj = *obj_ptr = nullptr; } return PlugIOManagerLoadGraphics(G, (ObjectCGO *) obj, @@ -963,7 +963,7 @@ pymol::CObject * PlugIOManagerLoad(PyMOLGlobals * G, pymol::CObject ** obj_ptr, " PlugIOManagerLoad: '%s' doesn't provide any read function\n", plugin_type ENDFB(G); ok_except1: - return NULL; + return nullptr; } #ifdef __cplusplus @@ -997,5 +997,5 @@ const char * PlugIOManagerFindPluginByExt(PyMOLGlobals * G, const char * ext, in } #endif - return NULL; + return nullptr; } diff --git a/layer3/Seeker.cpp b/layer3/Seeker.cpp index 326290969..defedc660 100644 --- a/layer3/Seeker.cpp +++ b/layer3/Seeker.cpp @@ -77,7 +77,7 @@ static void SeekerSelectionToggleRange(PyMOLGlobals * G, std::vector& r char prefix[3] = ""; int logging = SettingGetGlobal_i(G, cSetting_logging); int col_num; - int *atom_vla = NULL; + int *atom_vla = nullptr; int n_at = 0; int at_idx; int *atom_list; @@ -280,7 +280,7 @@ void SeekerSelectionCenter(PyMOLGlobals * G, int action) switch (action) { case 0: /* center cumulative */ - ExecutiveCenter(G, cTempCenterSele, -1, true, -1, NULL, true); + ExecutiveCenter(G, cTempCenterSele, -1, true, -1, nullptr, true); if(logging) { auto buf2 = pymol::string_format("%scmd.center(\"%s\")\n", prefix, cTempCenterSele); PLog(G, buf2, cPLog_no_flush); @@ -299,7 +299,7 @@ void SeekerSelectionCenter(PyMOLGlobals * G, int action) { char selName[WordLength]; if(ExecutiveGetActiveSeleName(G, selName, true, logging)) { - ExecutiveCenter(G, selName, -1, true, -1, NULL, true); + ExecutiveCenter(G, selName, -1, true, -1, nullptr, true); if(logging) { auto buf2 = pymol::string_format("%scmd.center(\"%s\")\n", prefix, selName); PLog(G, buf2, cPLog_no_flush); @@ -328,7 +328,7 @@ static CSeqRow *SeekerClick(PyMOLGlobals * G, std::vector& rowVLA, int if((UtilGetSeconds(G) - I->LastClickTime) < cDoubleTime) { char name[WordLength]; if(ExecutiveGetActiveSeleName(G, name, false, false)) { - SelectorCreate(G, name, "none", NULL, true, NULL); + SelectorCreate(G, name, "none", nullptr, true, nullptr); if(logging) { auto buf2 = pymol::string_format("cmd.select('%s','none', enable=1)", name); PLog(G, buf2, cPLog_no_flush); @@ -405,7 +405,7 @@ static CSeqRow *SeekerClick(PyMOLGlobals * G, std::vector& rowVLA, int SeekerSelectionCenter(G, action); I->box_active = true; if(col->state && (obj = ExecutiveFindObjectMoleculeByName(G, row->name))) { - SettingSetSmart_i(G, obj->Setting.get(), NULL, cSetting_state, col->state); + SettingSetSmart_i(G, obj->Setting.get(), nullptr, cSetting_state, col->state); SceneChanged(G); } } @@ -418,10 +418,10 @@ static CSeqRow *SeekerClick(PyMOLGlobals * G, std::vector& rowVLA, int if(mod & cOrthoCTRL) { center = 2; } - int codes = SettingGet_i(G, row->obj->Setting.get(), NULL, cSetting_seq_view_format); + int codes = SettingGet_i(G, row->obj->Setting.get(), nullptr, cSetting_seq_view_format); if(row->obj->DiscreteFlag && SettingGet_b(G, row->obj->Setting.get(), - NULL, cSetting_seq_view_discrete_by_state)) + nullptr, cSetting_seq_view_discrete_by_state)) codes = 4; if (codes != 4 || row->obj->DiscreteFlag) { // keep only non-discrete states selectable if(!continuation) { @@ -460,7 +460,7 @@ static CSeqRow *SeekerClick(PyMOLGlobals * G, std::vector& rowVLA, int SeekerSelectionCenter(G, 2); if(col->state && (obj = ExecutiveFindObjectMoleculeByName(G, row->name))) { - SettingSetSmart_i(G, obj->Setting.get(), NULL, cSetting_state, col->state); + SettingSetSmart_i(G, obj->Setting.get(), nullptr, cSetting_state, col->state); SceneChanged(G); } } @@ -468,7 +468,7 @@ static CSeqRow *SeekerClick(PyMOLGlobals * G, std::vector& rowVLA, int } } - return NULL; + return nullptr; } static void SeekerRefresh(PyMOLGlobals * G, std::vector& rowVLA) @@ -668,7 +668,7 @@ static CSeqRow *SeekerDrag(PyMOLGlobals * G, std::vector& rowVLA, int r break; } } - return NULL; + return nullptr; } static CSeqRow *SeekerRelease(PyMOLGlobals * G, std::vector& rowVLA, int button, @@ -678,7 +678,7 @@ static CSeqRow *SeekerRelease(PyMOLGlobals * G, std::vector& rowVLA, in I->dragging = false; I->box_active = false; - return NULL; + return nullptr; } char SeekerGetAbbr(PyMOLGlobals * G, const char *abbr, char water, char unknown) @@ -967,10 +967,10 @@ static int SeekerFindTag(PyMOLGlobals * G, const AtomInfoType * ai, int sele, in void SeekerUpdate(PyMOLGlobals * G) { - /* pymol::CObject *o = NULL; + /* pymol::CObject *o = nullptr; int s; */ - void *hidden = NULL; + void *hidden = nullptr; const AtomInfoType *ai; ObjectMolecule *obj; int nRow = 0; @@ -980,7 +980,7 @@ void SeekerUpdate(PyMOLGlobals * G) int default_color = 0; int align_sele = -1; /* alignment selection */ const int MAXCONSECUTIVEGAPS = 9; - CSeqRow *row, *lab = NULL; + CSeqRow *row, *lab = nullptr; std::vector row_vla; /* FIRST PASS: get all the residues represented properly */ label_mode = SettingGetGlobal_i(G, cSetting_seq_view_label_mode); @@ -991,8 +991,8 @@ void SeekerUpdate(PyMOLGlobals * G) bool isHidden = (SettingGet(G, cSetting_hide_underscore_names) && (obj->Name[0] == '_')); if (obj->Enabled && (SettingGet(*obj, cSetting_seq_view)) && !isHidden) { int a; - const AtomInfoType *last = NULL, *last_segi = NULL, *last_chain = NULL; - const CoordSet *last_disc = NULL; + const AtomInfoType *last = nullptr, *last_segi = nullptr, *last_chain = nullptr; + const CoordSet *last_disc = nullptr; int last_state; int last_abbr = true; int last_spacer = false; @@ -1001,23 +1001,23 @@ void SeekerUpdate(PyMOLGlobals * G) int est_col = obj->NAtom / 5 + 1; int est_char = obj->NAtom * 4; int first_atom_in_label; - int missing_color = SettingGet_i(G, obj->Setting.get(), NULL, cSetting_seq_view_fill_color); - const CoordSet *cs = obj->DiscreteFlag ? NULL : obj->getCoordSet(-2 /* current */); + int missing_color = SettingGet_i(G, obj->Setting.get(), nullptr, cSetting_seq_view_fill_color); + const CoordSet *cs = obj->DiscreteFlag ? nullptr : obj->getCoordSet(-2 /* current */); bool atom_in_state; int gapMode = SettingGet_i(G, obj->Setting.get(), nullptr, cSetting_seq_view_gap_mode); int min_pad = -1; - CSeqCol *r1 = NULL, *l1 = NULL; /* *col */ + CSeqCol *r1 = nullptr, *l1 = nullptr; /* *col */ if(nRow >= max_row) break; - codes = SettingGet_i(G, obj->Setting.get(), NULL, cSetting_seq_view_format); + codes = SettingGet_i(G, obj->Setting.get(), nullptr, cSetting_seq_view_format); if(obj->DiscreteFlag && SettingGet_b(G, obj->Setting.get(), - NULL, cSetting_seq_view_discrete_by_state)) + nullptr, cSetting_seq_view_discrete_by_state)) codes = 4; - default_color = SettingGet_i(G, obj->Setting.get(), NULL, cSetting_seq_view_color); + default_color = SettingGet_i(G, obj->Setting.get(), nullptr, cSetting_seq_view_color); /* allocate a row for labels, if present the text for the labels and the residues will line up exactly @@ -1030,7 +1030,7 @@ void SeekerUpdate(PyMOLGlobals * G) lab->col = pymol::vla(est_col); lab->label_flag = true; } else { - lab = NULL; + lab = nullptr; } VecCheck(row_vla, nRow); @@ -1802,7 +1802,7 @@ void SeekerUpdate(PyMOLGlobals * G) lab = row; else { for(b = 0; b < nCol; b++) { - CSeqCol *r1 = row->col + b, *l1 = NULL; + CSeqCol *r1 = row->col + b, *l1 = nullptr; if(lab) { l1 = lab->col + b; /* if a fixed label is present, get the final offset from the residue line */ @@ -1810,7 +1810,7 @@ void SeekerUpdate(PyMOLGlobals * G) l1->offset = r1->offset; } } - lab = NULL; + lab = nullptr; } } @@ -1832,20 +1832,20 @@ void SeekerUpdate(PyMOLGlobals * G) int draw_it; int n_skipped = 0; int last_resv = -1; - const AtomInfoType *last_ai = NULL; + const AtomInfoType *last_ai = nullptr; const ObjectMolecule *obj; const AtomInfoType *ai; row = lab + 1; nCol = row->nCol; obj = row->obj; - div = SettingGet_i(G, obj->Setting.get(), NULL, cSetting_seq_view_label_spacing); - sub = SettingGet_i(G, obj->Setting.get(), NULL, cSetting_seq_view_label_start); + div = SettingGet_i(G, obj->Setting.get(), nullptr, cSetting_seq_view_label_spacing); + sub = SettingGet_i(G, obj->Setting.get(), nullptr, cSetting_seq_view_label_start); for(b = 0; b < nCol; b++) { CSeqCol *r1 = row->col + b; CSeqCol *l1 = lab->col + b; - ai = NULL; + ai = nullptr; if(r1->atom_at) { atom_list = row->atom_lists + r1->atom_at; if(*atom_list >= 0) @@ -1949,7 +1949,7 @@ void SeekerUpdate(PyMOLGlobals * G) int SeekerInit(PyMOLGlobals * G) { - CSeeker *I = NULL; + CSeeker *I = nullptr; if((I = (G->Seeker = new CSeeker()))) { I->dragInfo.row = -1; I->LastClickTime = UtilGetSeconds(G) - 1.0F; diff --git a/layer3/Selector.cpp b/layer3/Selector.cpp index 432ed8bb6..4a9586b76 100644 --- a/layer3/Selector.cpp +++ b/layer3/Selector.cpp @@ -763,9 +763,9 @@ int SelectorResidueVLAsTo3DMatchScores(PyMOLGlobals * G, CMatch * match, for(pass = 0; pass < 2; pass++) { ObjectMolecule *obj; const CoordSet *cs; - const int *neighbor = NULL; - const AtomInfoType *atomInfo = NULL; - const ObjectMolecule *last_obj = NULL; + const int *neighbor = nullptr; + const AtomInfoType *atomInfo = nullptr; + const ObjectMolecule *last_obj = nullptr; float **dist_mat; float *inter; int state; @@ -801,7 +801,7 @@ int SelectorResidueVLAsTo3DMatchScores(PyMOLGlobals * G, CMatch * match, if(state < obj->NCSet) cs = obj->CSet[state]; else - cs = NULL; + cs = nullptr; if(cs && neighbor && atomInfo) { int idx_ca1 = cs->atmToIdx(at_ca1); @@ -873,7 +873,7 @@ int SelectorResidueVLAsTo3DMatchScores(PyMOLGlobals * G, CMatch * match, } if(idx_cb2 >= 0) { - const float *v_cb2 = NULL; + const float *v_cb2 = nullptr; v_cb2 = cs->coordPtr(idx_cb2); { float angle = get_dihedral3f(v_cb1, v_ca1, v_ca2, v_cb2); @@ -1037,9 +1037,9 @@ int SelectorClassifyAtoms(PyMOLGlobals * G, int sele, int preserve, ObjectMolecule * only_object) { CSelector *I = G->Selector; - ObjectMolecule *obj, *obj0, *obj1 = NULL; + ObjectMolecule *obj, *obj0, *obj1 = nullptr; int a, aa, at, a0, a1; - AtomInfoType *ai, *last_ai = NULL, *ai0, *ai1; + AtomInfoType *ai, *last_ai = nullptr, *ai0, *ai1; unsigned int mask; int n_dummies = 0; @@ -1082,7 +1082,7 @@ int SelectorClassifyAtoms(PyMOLGlobals * G, int sele, int preserve, if(SelectorIsMember(G, ai->selEntry, sele) && ((!AtomInfoSameResidueP(G, ai, last_ai)))) { - AtomInfoType *guide_atom = NULL; + AtomInfoType *guide_atom = nullptr; /* delimit residue */ @@ -1350,12 +1350,12 @@ int SelectorClassifyAtoms(PyMOLGlobals * G, int sele, int preserve, MapType *SelectorGetSpacialMapFromSeleCoord(PyMOLGlobals * G, int sele, int state, float cutoff, float **coord_vla) { - int *index_vla = NULL; - float *coord = NULL; + int *index_vla = nullptr; + float *coord = nullptr; int n, nc = 0; - MapType *result = NULL; + MapType *result = nullptr; if(sele < 0) - return NULL; + return nullptr; else { auto ptr = std::make_unique(G, G->SelectorMgr); CSelector mapSele(G, G->SelectorMgr); @@ -1387,7 +1387,7 @@ MapType *SelectorGetSpacialMapFromSeleCoord(PyMOLGlobals * G, int sele, int stat if(sta < obj->NCSet) cs = obj->CSet[sta]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(at); } else { @@ -1404,7 +1404,7 @@ MapType *SelectorGetSpacialMapFromSeleCoord(PyMOLGlobals * G, int sele, int stat } } if(nc) { - result = MapNew(G, cutoff, coord, nc, NULL); + result = MapNew(G, cutoff, coord, nc, nullptr); } } } @@ -1625,7 +1625,7 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, state_stop = SelectorGetSeleNCSet(G, target); if (state_value == cStateCurrent) { - StateIterator iter(G, NULL, state_value, state_stop); + StateIterator iter(G, nullptr, state_value, state_stop); if (iter.next()) { state_start = iter.state; state_stop = iter.state + 1; @@ -1641,7 +1641,7 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, int aa, a0, a1, at, idx; AtomInfoType *ai, *ai0, *ai1; CoordSet *cs; - ObjectMolecule *last_obj = NULL; + ObjectMolecule *last_obj = nullptr; /* first, we need to count the number of residues under consideration */ if(first_pass) { @@ -1726,7 +1726,7 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, if(preserve) { /* if we're in preserve mode, then mark which objects don't get changed */ int a, b; char ss; - ObjectMolecule *p_obj = NULL; + ObjectMolecule *p_obj = nullptr; SSResi *r, *r2; for(a = 0; a < n_res; a++) { r = res + a; @@ -1814,7 +1814,7 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, if(state < obj->NCSet) cs = obj->CSet[state]; else - cs = NULL; + cs = nullptr; for(b = 0; b < 4; b++) { if(cs) { switch (b) { @@ -1861,11 +1861,11 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, CoordSet *cs; float cutoff; HBondCriteria hbcRec, *hbc; - int *zero = NULL, *scratch = NULL; + int *zero = nullptr, *scratch = nullptr; { int max_n_atom = I->Table.size(); - ObjectMolecule *lastObj = NULL; + ObjectMolecule *lastObj = nullptr; for(a = cNDummyAtoms; a < I->Table.size(); a++) { ObjectMolecule *obj = I->Obj[I->Table[a].model]; if(obj != lastObj) { @@ -1983,7 +1983,7 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, ); } */ - if((!exclude) && ObjectMoleculeGetCheckHBond(NULL, NULL, obj1, /* donor first */ + if((!exclude) && ObjectMoleculeGetCheckHBond(NULL, nullptr, obj1, /* donor first */ at1, state, obj0, /* then acceptor */ at0, state, hbc)) { @@ -2036,31 +2036,31 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, float helix_psi_delta, helix_phi_delta; float strand_psi_delta, strand_phi_delta; - float helix_psi_target = SettingGet_f(G, NULL, NULL, cSetting_ss_helix_psi_target); + float helix_psi_target = SettingGet_f(G, nullptr, nullptr, cSetting_ss_helix_psi_target); float helix_psi_include = - SettingGet_f(G, NULL, NULL, cSetting_ss_helix_psi_include); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_helix_psi_include); float helix_psi_exclude = - SettingGet_f(G, NULL, NULL, cSetting_ss_helix_psi_exclude); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_helix_psi_exclude); - float helix_phi_target = SettingGet_f(G, NULL, NULL, cSetting_ss_helix_phi_target); + float helix_phi_target = SettingGet_f(G, nullptr, nullptr, cSetting_ss_helix_phi_target); float helix_phi_include = - SettingGet_f(G, NULL, NULL, cSetting_ss_helix_phi_include); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_helix_phi_include); float helix_phi_exclude = - SettingGet_f(G, NULL, NULL, cSetting_ss_helix_phi_exclude); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_helix_phi_exclude); float strand_psi_target = - SettingGet_f(G, NULL, NULL, cSetting_ss_strand_psi_target); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_strand_psi_target); float strand_psi_include = - SettingGet_f(G, NULL, NULL, cSetting_ss_strand_psi_include); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_strand_psi_include); float strand_psi_exclude = - SettingGet_f(G, NULL, NULL, cSetting_ss_strand_psi_exclude); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_strand_psi_exclude); float strand_phi_target = - SettingGet_f(G, NULL, NULL, cSetting_ss_strand_phi_target); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_strand_phi_target); float strand_phi_include = - SettingGet_f(G, NULL, NULL, cSetting_ss_strand_phi_include); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_strand_phi_include); float strand_phi_exclude = - SettingGet_f(G, NULL, NULL, cSetting_ss_strand_phi_exclude); + SettingGet_f(G, nullptr, nullptr, cSetting_ss_strand_phi_exclude); for(a = 0; a < n_res; a++) { r = res + a; @@ -2615,7 +2615,7 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, { int a, aa; - ObjectMolecule *obj = NULL, *last_obj = NULL; + ObjectMolecule *obj = nullptr, *last_obj = nullptr; AtomInfoType *ai; int changed_flag = false; @@ -2661,13 +2661,13 @@ int SelectorAssignSS(PyMOLGlobals * G, int target, int present, PyObject *SelectorColorectionGet(PyMOLGlobals * G, const char *prefix) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else auto I = G->Selector; auto IM = G->SelectorMgr; - PyObject *result = NULL; + PyObject *result = nullptr; int n_used = 0; - ColorectionRec *used = NULL, tmp; + ColorectionRec *used = nullptr, tmp; ov_size a, b; int found; int color; @@ -2735,20 +2735,20 @@ int SelectorColorectionApply(PyMOLGlobals * G, PyObject * list, const char *pref CSelector *I = G->Selector; int ok = true; - ColorectionRec *used = NULL; + ColorectionRec *used = nullptr; ov_size n_used = 0; int a, b; AtomInfoType *ai; - ObjectMolecule *obj, *last = NULL; + ObjectMolecule *obj, *last = nullptr; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) n_used = PyList_Size(list) / 2; if(ok) - ok = ((used = VLAlloc(ColorectionRec, n_used)) != NULL); + ok = ((used = VLAlloc(ColorectionRec, n_used)) != nullptr); if(ok) ok = PConvPyListToIntArrayInPlace(list, (int *) used, n_used * 2); if(ok) { @@ -2789,18 +2789,18 @@ int SelectorColorectionSetName(PyMOLGlobals * G, PyObject * list, const char *pr #else int ok = true; - ColorectionRec *used = NULL; + ColorectionRec *used = nullptr; ov_size n_used = 0; ov_size b; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) n_used = PyList_Size(list) / 2; if(ok) - ok = ((used = VLAlloc(ColorectionRec, n_used)) != NULL); + ok = ((used = VLAlloc(ColorectionRec, n_used)) != nullptr); if(ok) ok = PConvPyListToIntArrayInPlace(list, (int *) used, n_used * 2); if(ok) { @@ -2823,18 +2823,18 @@ int SelectorColorectionFree(PyMOLGlobals * G, PyObject * list, const char *prefi #else int ok = true; - ColorectionRec *used = NULL; + ColorectionRec *used = nullptr; ov_size n_used = 0; ov_size b; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) n_used = PyList_Size(list) / 2; if(ok) - ok = ((used = VLAlloc(ColorectionRec, n_used)) != NULL); + ok = ((used = VLAlloc(ColorectionRec, n_used)) != nullptr); if(ok) ok = PConvPyListToIntArrayInPlace(list, (int *) used, n_used * 2); if(ok) { @@ -2882,11 +2882,11 @@ int SelectorSecretsFromPyList(PyMOLGlobals * G, PyObject * list) int ok = true; ov_size n_secret = 0; ov_size a; - PyObject *entry = NULL; + PyObject *entry = nullptr; std::string name; ov_size ll = 0; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) @@ -2896,7 +2896,7 @@ int SelectorSecretsFromPyList(PyMOLGlobals * G, PyObject * list) if(ok) entry = PyList_GetItem(list, a); if(ok) - ok = (entry != NULL); + ok = (entry != nullptr); if(ok) ok = PyList_Check(entry); if(ok) @@ -2929,13 +2929,13 @@ PyObject *SelectorAsPyList(PyMOLGlobals * G, SelectorID_t sele1) int a, b; int at; int s; - SelAtomTag **vla_list = NULL; + SelAtomTag **vla_list = nullptr; int n_obj = 0; int n_idx = 0; int cur = -1; - ObjectMolecule **obj_list = NULL; - ObjectMolecule *obj, *cur_obj = NULL; - PyObject *result = NULL; + ObjectMolecule **obj_list = nullptr; + ObjectMolecule *obj, *cur_obj = nullptr; + PyObject *result = nullptr; PyObject *obj_pyobj; PyObject *idx_pyobj; PyObject *tag_pyobj; @@ -3005,15 +3005,15 @@ int SelectorFromPyList(PyMOLGlobals * G, const char *name, PyObject * list) auto I = G->SelectorMgr; ov_size a, b; ov_size ll; - PyObject *obj_list = NULL; - PyObject *idx_list = NULL, *tag_list; + PyObject *obj_list = nullptr; + PyObject *idx_list = nullptr, *tag_list; ov_size n_obj = 0, n_idx = 0; int idx, tag; const char *oname; ObjectMolecule *obj; int singleAtomFlag = true; int singleObjectFlag = true; - ObjectMolecule *singleObject = NULL; + ObjectMolecule *singleObject = nullptr; int singleAtom = -1; if(ok) @@ -3037,7 +3037,7 @@ int SelectorFromPyList(PyMOLGlobals * G, const char *name, PyObject * list) ll = PyList_Size(obj_list); if(ok) ok = PConvPyStrToStrPtr(PyList_GetItem(obj_list, 0), &oname); - obj = NULL; + obj = nullptr; if(ok) obj = ExecutiveFindObjectMoleculeByName(G, oname); if(ok && obj) { @@ -3046,7 +3046,7 @@ int SelectorFromPyList(PyMOLGlobals * G, const char *name, PyObject * list) if(ll > 2) tag_list = PyList_GetItem(obj_list, 2); else - tag_list = NULL; + tag_list = nullptr; if(ok) ok = PyList_Check(idx_list); if(ok) @@ -3272,10 +3272,10 @@ int SelectorGetPairIndices(PyMOLGlobals * G, int sele1, int state1, int sele2, i if(dist < cutoff) { if(mode == 1) { /* coarse hydrogen bonding assessment */ flag = false; - if(ObjectMoleculeGetAvgHBondVector(obj1, at1, state1, v1, NULL) > 0.3) + if(ObjectMoleculeGetAvgHBondVector(obj1, at1, state1, v1, nullptr) > 0.3) if(dot_product3f(v1, dir) < -angle_cutoff) flag = true; - if(ObjectMoleculeGetAvgHBondVector(obj2, at2, state2, v2, NULL) > 0.3) + if(ObjectMoleculeGetAvgHBondVector(obj2, at2, state2, v2, nullptr) > 0.3) if(dot_product3f(v2, dir) > angle_cutoff) flag = true; } else @@ -3312,7 +3312,7 @@ int SelectorCreateAlignments(PyMOLGlobals * G, int identical, int atomic_input) { CSelector *I = G->Selector; - int *flag1 = NULL, *flag2 = NULL; + int *flag1 = nullptr, *flag2 = nullptr; int *p; int i, np; int cnt; @@ -3416,8 +3416,8 @@ int SelectorCreateAlignments(PyMOLGlobals * G, } } if(cnt) { - SelectorEmbedSelection(G, flag1, name1, NULL, false, -1); - SelectorEmbedSelection(G, flag2, name2, NULL, false, -1); + SelectorEmbedSelection(G, flag1, name1, nullptr, false, -1); + SelectorEmbedSelection(G, flag2, name2, nullptr, false, -1); } FreeP(flag1); FreeP(flag2); @@ -3435,7 +3435,7 @@ int SelectorCountStates(PyMOLGlobals * G, int sele) int result = 0; int n_frame; int at1; - ObjectMolecule *last = NULL; + ObjectMolecule *last = nullptr; ObjectMolecule *obj; SelectorUpdateTable(G, cSelectorUpdateTableAllStates, -1); for(a = cNDummyAtoms; a < I->Table.size(); a++) { @@ -3515,8 +3515,8 @@ int *SelectorGetResidueVLA(PyMOLGlobals * G, SelectorID_t sele, int ca_only, The indices are the first and last residue in the selection... */ CSelector *I = G->Selector; - int *result = NULL, *r; - AtomInfoType *ai1 = NULL, *ai2; + int *result = nullptr, *r; + AtomInfoType *ai1 = nullptr, *ai2; /* update the selector's table */ SelectorUpdateTable(G, cSelectorUpdateTableAllStates, -1); @@ -3576,7 +3576,7 @@ static int *SelectorGetIndexVLA(PyMOLGlobals * G, SelectorID_t sele) static int *SelectorGetIndexVLAImpl(PyMOLGlobals * G, CSelector *I, SelectorID_t sele) { /* assumes updated tables */ int a, c = 0; - int *result = NULL; + int *result = nullptr; ObjectMolecule *obj; int at1; @@ -3598,7 +3598,7 @@ static int *SelectorGetIndexVLAImpl(PyMOLGlobals * G, CSelector *I, SelectorID_t void SelectorUpdateObjectSele(PyMOLGlobals * G, ObjectMolecule * obj) { if(obj->Name[0]) { - SelectorCreate(G, obj->Name, NULL, obj, true, NULL); + SelectorCreate(G, obj->Name, nullptr, obj, true, nullptr); /* create a selection with same name */ if(SettingGetGlobal_b(G, cSetting_auto_classify_atoms)) { @@ -3738,7 +3738,7 @@ bool SelectorMoveMember(PyMOLGlobals * G, SelectorMemberOffset_t s, SelectorID_t ObjectMolecule *SelectorGetFastSingleObjectMolecule(PyMOLGlobals * G, SelectorID_t sele) { auto I = G->SelectorMgr; - ObjectMolecule *result = NULL; + ObjectMolecule *result = nullptr; auto it = std::find_if(I->Info.begin(), I->Info.end(), [sele](const SelectionInfoRec& rec) { return rec.ID == sele; }); if (it != I->Info.end()) { @@ -3759,7 +3759,7 @@ ObjectMolecule *SelectorGetFastSingleAtomObjectIndex(PyMOLGlobals * G, SelectorI int *index) { auto I = G->SelectorMgr; - ObjectMolecule *result = NULL; + ObjectMolecule *result = nullptr; auto it = std::find_if(I->Info.begin(), I->Info.end(), [sele](const SelectionInfoRec& rec) { return rec.ID == sele; }); if (it != I->Info.end()) { @@ -3792,14 +3792,14 @@ ObjectMolecule *SelectorGetFastSingleAtomObjectIndex(PyMOLGlobals * G, SelectorI * PARAMS * (int) selection # * RETURNS - * (ptr) pts to the ObjectMolecule or NULL if not found + * (ptr) pts to the ObjectMolecule or nullptr if not found */ ObjectMolecule *SelectorGetSingleObjectMolecule(PyMOLGlobals * G, SelectorID_t sele) { /* slow way */ int a; - ObjectMolecule *result = NULL; + ObjectMolecule *result = nullptr; ObjectMolecule *obj; CSelector *I = G->Selector; int at1; @@ -3811,7 +3811,7 @@ ObjectMolecule *SelectorGetSingleObjectMolecule(PyMOLGlobals * G, SelectorID_t s if(SelectorIsMember(G, obj->AtomInfo[at1].selEntry, sele)) { if(result) { if(result != obj) { - result = NULL; + result = nullptr; break; } } else { @@ -3829,7 +3829,7 @@ ObjectMolecule *SelectorGetFirstObjectMolecule(PyMOLGlobals * G, SelectorID_t se /* slow way */ int a; - ObjectMolecule *result = NULL; + ObjectMolecule *result = nullptr; ObjectMolecule *obj; CSelector *I = G->Selector; int at1; @@ -3851,8 +3851,8 @@ ObjectMolecule *SelectorGetFirstObjectMolecule(PyMOLGlobals * G, SelectorID_t se ObjectMolecule **SelectorGetObjectMoleculeVLA(PyMOLGlobals * G, SelectorID_t sele) { int a; - ObjectMolecule *last = NULL; - ObjectMolecule *obj, **result = NULL; + ObjectMolecule *last = nullptr; + ObjectMolecule *obj, **result = nullptr; CSelector *I = G->Selector; int at1; int n = 0; @@ -3882,8 +3882,8 @@ pymol::Result> SelectorGetSingleAtomObjectIndex( /* slow way */ bool found_it = false; - void *iterator = NULL; - ObjectMolecule *obj = NULL; + void *iterator = nullptr; + ObjectMolecule *obj = nullptr; std::pair result; while(ExecutiveIterateObjectMolecule(G, &obj, &iterator)) { @@ -4180,25 +4180,25 @@ int SelectorSubdivide(PyMOLGlobals* G, // { CSelector *I = G->Selector; int a0 = 0, a1 = 0, a2; - int *atom = NULL; - int *toDo = NULL; - int *comp = NULL; - int *pkset = NULL; + int *atom = nullptr; + int *toDo = nullptr; + int *comp = nullptr; + int *pkset = nullptr; int set_cnt = 0; int nFrag = 0; int stkDepth; int c; int cycFlag = false; std::string name, link_sele; - ObjectMolecule *obj1 = NULL, *obj2 = NULL, *obj3 = NULL, *obj4 = NULL; + ObjectMolecule *obj1 = nullptr, *obj2 = nullptr, *obj3 = nullptr, *obj4 = nullptr; int index1 = 0, index2 = 0, index3 = 0, index4 = 0; /* this is seriously getting out of hand -- need to switch over to arrays soon */ - int *atom1_base = NULL, *atom2_base = NULL, *atom3_base = NULL, *atom4_base = NULL; - int *toDo1_base = NULL, *toDo2_base = NULL, *toDo3_base = NULL, *toDo4_base = NULL; - int *comp1_base = NULL, *comp2_base = NULL, *comp3_base = NULL, *comp4_base = NULL; - int *pkset1_base = NULL, *pkset2_base = NULL, *pkset3_base = NULL, *pkset4_base = NULL; + int *atom1_base = nullptr, *atom2_base = nullptr, *atom3_base = nullptr, *atom4_base = nullptr; + int *toDo1_base = nullptr, *toDo2_base = nullptr, *toDo3_base = nullptr, *toDo4_base = nullptr; + int *comp1_base = nullptr, *comp2_base = nullptr, *comp3_base = nullptr, *comp4_base = nullptr; + int *pkset1_base = nullptr, *pkset2_base = nullptr, *pkset3_base = nullptr, *pkset4_base = nullptr; PRINTFD(G, FB_Selector) " SelectorSubdivideObject: entered...\n" ENDFD; @@ -4291,7 +4291,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // pkset1_base[a0] = 1; pkset1_base[a1] = 1; - SelectorEmbedSelection(G, pkset, cEditorBond, NULL, false, -1); + SelectorEmbedSelection(G, pkset, cEditorBond, nullptr, false, -1); a0 = index1; if(a0 >= 0) { @@ -4305,7 +4305,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // atom1_base[a0] = 1; /* create selection for this atom alone as fragment base atom */ comp1_base[a0] = 1; name = pymol::string_format("%s%1d", fragPref, nFrag + 1); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); c = SelectorWalkTree(G, atom1_base, comp1_base, toDo1_base, &stk, stkDepth, obj1, sele1, sele2, -1, -1) + 1; @@ -4340,7 +4340,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // obj1, sele1, sele2, -1, -1) + 1; } } - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); nFrag++; } @@ -4358,12 +4358,12 @@ int SelectorSubdivide(PyMOLGlobals* G, // atom1_base[a0] = 1; /* create selection for this atom alone as fragment base atom */ comp1_base[a0] = 1; name = pymol::string_format("%s%1d", fragPref, nFrag + 1); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); c = SelectorWalkTree(G, atom1_base, comp1_base, toDo1_base, &stk, stkDepth, obj1, sele1, sele2, -1, -1) + 1; name = pymol::string_format("%s%1d", pref, nFrag + 1); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); nFrag++; } } @@ -4392,7 +4392,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // atom1_base[a1] = 1; /* create selection for this atom alone as fragment base atom */ comp1_base[a1] = 1; name = pymol::string_format("%s%1d", fragPref, nFrag + 1); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); atom1_base[a1] = 0; c = SelectorWalkTreeDepth(G, atom1_base, comp1_base, toDo1_base, &stk, stkDepth, obj1, sele1, sele2, sele3, sele4, @@ -4400,7 +4400,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // if(c) { nFrag++; name = pymol::string_format("%s%1d", pref, nFrag); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); update_min_walk_depth(&minWalk, nFrag, &curWalk, sele1, sele2, sele3, sele4); } @@ -4425,7 +4425,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // atom2_base[a1] = 1; /* create selection for this atom alone as fragment base atom */ comp2_base[a1] = 1; name = pymol::string_format("%s%1d", fragPref, nFrag + 1); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); atom2_base[a1] = 0; c = SelectorWalkTreeDepth(G, atom2_base, comp2_base, toDo2_base, &stk, stkDepth, obj2, sele1, sele2, sele3, sele4, @@ -4433,7 +4433,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // if(c) { nFrag++; name = pymol::string_format("%s%1d", pref, nFrag); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); update_min_walk_depth(&minWalk, nFrag, &curWalk, sele1, sele2, sele3, sele4); } @@ -4458,7 +4458,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // atom3_base[a1] = 1; /* create selection for this atom alone as fragment base atom */ comp3_base[a1] = 1; name = pymol::string_format("%s%1d", fragPref, nFrag + 1); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); atom3_base[a1] = 0; c = SelectorWalkTreeDepth(G, atom3_base, comp3_base, toDo3_base, &stk, stkDepth, obj3, sele1, sele2, sele3, sele4, @@ -4466,7 +4466,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // if(c) { nFrag++; name = pymol::string_format("%s%1d", pref, nFrag); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); update_min_walk_depth(&minWalk, nFrag, &curWalk, sele1, sele2, sele3, sele4); @@ -4492,7 +4492,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // atom4_base[a1] = 1; /* create selection for this atom alone as fragment base atom */ comp4_base[a1] = 1; name = pymol::string_format("%s%1d", fragPref, nFrag + 1); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); atom4_base[a1] = 0; c = SelectorWalkTreeDepth(G, atom4_base, comp4_base, toDo4_base, &stk, stkDepth, obj4, sele1, sele2, sele3, sele4, @@ -4500,7 +4500,7 @@ int SelectorSubdivide(PyMOLGlobals* G, // if(c) { nFrag++; name = pymol::string_format("%s%1d", pref, nFrag); - SelectorEmbedSelection(G, atom, name, NULL, false, -1); + SelectorEmbedSelection(G, atom, name, nullptr, false, -1); update_min_walk_depth(&minWalk, nFrag, &curWalk, sele1, sele2, sele3, sele4); } @@ -4516,15 +4516,15 @@ int SelectorSubdivide(PyMOLGlobals* G, // } if(set_cnt > 1) { - SelectorEmbedSelection(G, pkset, cEditorSet, NULL, false, -1); + SelectorEmbedSelection(G, pkset, cEditorSet, nullptr, false, -1); } if(nFrag) { - SelectorEmbedSelection(G, comp, compName, NULL, false, -1); + SelectorEmbedSelection(G, comp, compName, nullptr, false, -1); } if(!link_sele.empty()) - SelectorCreate(G, cEditorLink, link_sele.c_str(), NULL, true, NULL); + SelectorCreate(G, cEditorLink, link_sele.c_str(), nullptr, true, nullptr); FreeP(toDo); FreeP(atom); @@ -4545,7 +4545,7 @@ int SelectorGetSeleNCSet(PyMOLGlobals * G, SelectorID_t sele) CSelector *I = G->Selector; int a, s, at = 0; - ObjectMolecule *obj, *last_obj = NULL; + ObjectMolecule *obj, *last_obj = nullptr; int result = 0; if((obj = SelectorGetFastSingleAtomObjectIndex(G, sele, &at))) { @@ -4762,7 +4762,7 @@ int SelectorMapMaskVDW(PyMOLGlobals * G, int sele1, ObjectMapState * oMap, float if(state1 < obj->NCSet) cs = obj->CSet[state1]; else - cs = NULL; + cs = nullptr; if(cs) { if(CoordSetGetAtomVertex(cs, at, coords[a])) { Flag1[a] = true; @@ -4847,17 +4847,17 @@ int SelectorMapGaussian(PyMOLGlobals * G, int sele1, ObjectMapState * oMap, ObjectMolecule *obj; CoordSet *cs; int state1, state2; - float *point = NULL, *fp; - int *sfidx = NULL, *ip; - float *b_factor = NULL, *bf, bfact; - float *occup = NULL, *oc; + float *point = nullptr, *fp; + int *sfidx = nullptr, *ip; + float *b_factor = nullptr, *bf, bfact; + float *occup = nullptr, *oc; int prot; int once_flag; float d, e_val; double sum, sumsq; float mean, stdev; double sf[256][11], *sfp; - AtomSF *atom_sf = NULL; + AtomSF *atom_sf = nullptr; double b_adjust = (double) SettingGetGlobal_f(G, cSetting_gaussian_b_adjust); double elim = 7.0; double rcut2; @@ -5122,7 +5122,7 @@ int SelectorMapGaussian(PyMOLGlobals * G, int sele1, ObjectMapState * oMap, if(state2 < obj->NCSet) cs = obj->CSet[state2]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(at); if(idx >= 0) { @@ -5167,7 +5167,7 @@ int SelectorMapGaussian(PyMOLGlobals * G, int sele1, ObjectMapState * oMap, if(state2 < obj->NCSet) cs = obj->CSet[state2]; else - cs = NULL; + cs = nullptr; if(cs) { if(CoordSetGetAtomVertex(cs, at, fp)) { prot = ai->protons; @@ -5335,8 +5335,8 @@ int SelectorMapCoulomb(PyMOLGlobals * G, int sele1, ObjectMapState * oMap, int once_flag; int n_at = 0; double tot_charge = 0.0; - float *point = NULL; - float *charge = NULL; + float *point = nullptr; + float *charge = nullptr; int n_point = 0; int n_occur; float *v0, *v1; @@ -5377,7 +5377,7 @@ int SelectorMapCoulomb(PyMOLGlobals * G, int sele1, ObjectMapState * oMap, if(state1 < obj->NCSet) cs = obj->CSet[state1]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(at); if(idx >= 0) { @@ -5401,7 +5401,7 @@ int SelectorMapCoulomb(PyMOLGlobals * G, int sele1, ObjectMapState * oMap, if(state1 < obj->NCSet) cs = obj->CSet[state1]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(at); if(idx >= 0) { @@ -5569,7 +5569,7 @@ int SelectorAssignAtomTypes(PyMOLGlobals * G, int sele, int state, int quiet, in SelectorUpdateTable(G, state, -1); if(ok) { - ObjectMolecule *prevobj = NULL; + ObjectMolecule *prevobj = nullptr; int a; for(a = cNDummyAtoms; a < I->Table.size(); a++) { int at = I->Table[a].atom; @@ -5601,7 +5601,7 @@ int SelectorAssignAtomTypes(PyMOLGlobals * G, int sele, int state, int quiet, in SelectorUpdateTable(G, state, -1); - ObjectMolecule *obj = NULL; + ObjectMolecule *obj = nullptr; for (SeleAtomIterator iter(G, sele); iter.next();) { if (obj != iter.obj) { @@ -5628,25 +5628,25 @@ PyObject *SelectorGetCoordsAsNumPy(PyMOLGlobals * G, int sele, int state) { #ifndef _PYMOL_NUMPY printf("No numpy support\n"); - return NULL; + return nullptr; #else double matrix[16]; - double *matrix_ptr = NULL; + double *matrix_ptr = nullptr; float *v_ptr, v_tmp[3], *dataptr; int i, nAtom = 0; int typenum = -1; const int base_size = sizeof(float); SeleCoordIterator iter(G, sele, state); - CoordSet *mat_cs = NULL; - PyObject *result = NULL; + CoordSet *mat_cs = nullptr; + PyObject *result = nullptr; npy_intp dims[2] = {0, 3}; for(iter.reset(); iter.next();) nAtom++; if(!nAtom) - return NULL; + return nullptr; dims[0] = nAtom; @@ -5659,7 +5659,7 @@ PyObject *SelectorGetCoordsAsNumPy(PyMOLGlobals * G, int sele, int state) if(typenum == -1) { printf("error: no typenum for float size %d\n", base_size); - return NULL; + return nullptr; } result = PyArray_SimpleNew(2, dims, typenum); @@ -5670,7 +5670,7 @@ PyObject *SelectorGetCoordsAsNumPy(PyMOLGlobals * G, int sele, int state) if(mat_cs != iter.cs) { /* compute the effective matrix for output coordinates */ - matrix_ptr = ObjectGetTotalMatrix(iter.obj, state, false, matrix) ? matrix : NULL; + matrix_ptr = ObjectGetTotalMatrix(iter.obj, state, false, matrix) ? matrix : nullptr; mat_cs = iter.cs; } @@ -5701,11 +5701,11 @@ pymol::Result<> SelectorLoadCoords(PyMOLGlobals * G, PyObject * coords, int sele #else double matrix[16]; - double *matrix_ptr = NULL; + double *matrix_ptr = nullptr; float v_xyz[3]; int a, b, nAtom = 0, itemsize; SeleCoordIterator iter(G, sele, state); - CoordSet *mat_cs = NULL; + CoordSet *mat_cs = nullptr; PyObject *v, *w; bool is_np_array = false; void * ptr; @@ -5786,7 +5786,7 @@ pymol::Result<> SelectorLoadCoords(PyMOLGlobals * G, PyObject * coords, int sele // coord set specific stuff if(mat_cs != iter.cs) { // update matrix - matrix_ptr = ObjectGetTotalMatrix(iter.obj, state, false, matrix) ? matrix : NULL; + matrix_ptr = ObjectGetTotalMatrix(iter.obj, state, false, matrix) ? matrix : nullptr; mat_cs = iter.cs; // invalidate reps @@ -5817,7 +5817,7 @@ pymol::Result<> SelectorUpdateCmd(PyMOLGlobals* G, // int at0 = 0, at1; int c0 = 0, c1 = 0; int i0 = 0, i1; - ObjectMolecule *obj0 = NULL, *obj1; + ObjectMolecule *obj0 = nullptr, *obj1; CoordSet *cs0; const CoordSet *cs1; int matched_flag; @@ -6000,7 +6000,7 @@ pymol::Result<> SelectorUpdateCmd(PyMOLGlobals* G, // } } } - obj0 = NULL; + obj0 = nullptr; { ObjectMolecule **objs = SelectorGetObjectMoleculeVLA(G, sele0); @@ -6035,12 +6035,12 @@ int SelectorCreateObjectMolecule(PyMOLGlobals * G, SelectorID_t sele, const char int nBond = 0; int nCSet, nAtom, ts; int isNew; - CoordSet *cs = NULL; + CoordSet *cs = nullptr; CoordSet *cs1, *cs2; ObjectMolecule *obj; pymol::CObject *ob; - ObjectMolecule *targ = NULL; - ObjectMolecule *info_src = NULL; + ObjectMolecule *targ = nullptr; + ObjectMolecule *info_src = nullptr; int static_singletons = SettingGetGlobal_b(G, cSetting_static_singletons); if(singletons < 0) @@ -6061,7 +6061,7 @@ int SelectorCreateObjectMolecule(PyMOLGlobals * G, SelectorID_t sele, const char targ->Bond = pymol::vla(1); { /* copy object color of previous object (if any) */ - ObjectMolecule *singleObj = NULL; + ObjectMolecule *singleObj = nullptr; for(a = cNDummyAtoms; a < I->Table.size(); a++) { at = I->Table[a].atom; I->Table[a].index = -1; @@ -6071,7 +6071,7 @@ int SelectorCreateObjectMolecule(PyMOLGlobals * G, SelectorID_t sele, const char if(!singleObj) singleObj = obj; else if(singleObj && (obj != singleObj)) { - singleObj = NULL; + singleObj = nullptr; break; } } @@ -6203,7 +6203,7 @@ int SelectorCreateObjectMolecule(PyMOLGlobals * G, SelectorID_t sele, const char ErrFatal(G, "SelectorCreate", "inconsistent selection."); /* cs->IdxToAtm now has the relevant indexes for the coordinate transfer */ - for(StateIterator iter(G, NULL, source, nCSet); iter.next();) { + for(StateIterator iter(G, nullptr, source, nCSet); iter.next();) { d = iter.state; { cs2 = CoordSetNew(G); @@ -6213,7 +6213,7 @@ int SelectorCreateObjectMolecule(PyMOLGlobals * G, SelectorID_t sele, const char if(I->Table[a].index >= 0) { at = I->Table[a].atom; obj = I->Obj[I->Table[a].model]; - cs1 = NULL; + cs1 = nullptr; if(d < obj->NCSet) { cs1 = obj->CSet[d]; } else if(singletons && (obj->NCSet == 1)) { @@ -6326,8 +6326,8 @@ SelectorID_t SelectorIndexByName(PyMOLGlobals * G, const char *sname, int ignore static void SelectorPurgeMembers(PyMOLGlobals * G, SelectorID_t sele) { auto I = G->SelectorMgr; - void *iterator = NULL; - ObjectMolecule *obj = NULL; + void *iterator = nullptr; + ObjectMolecule *obj = nullptr; short changed = 0; if(!I->Member.empty()) { @@ -6524,7 +6524,7 @@ SelectorGetTmp2Result(PyMOLGlobals * G, const char *input, char *store, bool qui if(is_selection) { /* incur the computational expense of parsing the input as an atom selection */ SelectorGetUniqueTmpName(G, store); - auto res = SelectorCreate(G, store, input, NULL, quiet, NULL); + auto res = SelectorCreate(G, store, input, nullptr, quiet, nullptr); if (!res) { store[0] = 0; } @@ -6572,7 +6572,7 @@ SelectorGetTmpResult(PyMOLGlobals * G, const char *input, char *store, bool quie // evaluate expression and create a temp selection SelectorGetUniqueTmpName(G, store); - auto res = SelectorCreate(G, store, input, NULL, quiet, NULL); + auto res = SelectorCreate(G, store, input, nullptr, quiet, nullptr); if(!res) { store[0] = 0; @@ -6595,7 +6595,7 @@ void SelectorFreeTmp(PyMOLGlobals * G, const char *name) static int SelectorEmbedSelection(PyMOLGlobals * G, const int *atom, pymol::zstring_view name, ObjectMolecule * obj, int no_dummies, int exec_managed) { - /* either atom or obj should be NULL, not both and not neither */ + /* either atom or obj should be nullptr, not both and not neither */ CSelector *I = G->Selector; auto IM = I->mgr; @@ -6606,7 +6606,7 @@ static int SelectorEmbedSelection(PyMOLGlobals * G, const int *atom, pymol::zstr int start = 0; int singleAtomFlag = true; int singleObjectFlag = true; - ObjectMolecule *singleObject = NULL, *selObj; + ObjectMolecule *singleObject = nullptr, *selObj; int singleAtom = -1; int index; AtomInfoType *ai; @@ -6769,7 +6769,7 @@ _SelectorCreate(PyMOLGlobals * G, pymol::zstring_view sname, const char *sele, std::string name; int c = 0; int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); - ObjectMolecule *embed_obj = NULL; + ObjectMolecule *embed_obj = nullptr; if (!SelectorIsTmp(sname)) { if (sname.starts_with('%')) { @@ -6831,40 +6831,40 @@ _SelectorCreate(PyMOLGlobals * G, pymol::zstring_view sname, const char *sele, SelectorCreateResult_t SelectorCreateFromTagDict(PyMOLGlobals * G, const char *sname, const std::unordered_map& id2tag, int exec_managed) { - return _SelectorCreate(G, sname, NULL, NULL, true, NULL, NULL, 0, NULL, NULL, 0, &id2tag, + return _SelectorCreate(G, sname, nullptr, nullptr, true, nullptr, nullptr, 0, nullptr, nullptr, 0, &id2tag, exec_managed, -1, -1); } SelectorCreateResult_t SelectorCreateEmpty(PyMOLGlobals * G, const char *name, int exec_managed) { - return _SelectorCreate(G, name, "none", NULL, 1, NULL, NULL, 0, NULL, 0, 0, NULL, + return _SelectorCreate(G, name, "none", nullptr, 1, nullptr, nullptr, 0, nullptr, 0, 0, nullptr, exec_managed, -1, -1); } SelectorCreateResult_t SelectorCreateSimple(PyMOLGlobals * G, const char *name, const char *sele) { - return _SelectorCreate(G, name, sele, NULL, 1, NULL, NULL, 0, NULL, 0, 0, NULL, -1, -1, + return _SelectorCreate(G, name, sele, nullptr, 1, nullptr, nullptr, 0, nullptr, 0, 0, nullptr, -1, -1, -1); } SelectorCreateResult_t SelectorCreateFromObjectIndices(PyMOLGlobals * G, const char *sname, ObjectMolecule * obj, int *idx, int n_idx) { - return _SelectorCreate(G, sname, NULL, &obj, true, NULL, NULL, 0, &idx, &n_idx, -1, NULL, -1, -1, -1); + return _SelectorCreate(G, sname, nullptr, &obj, true, nullptr, nullptr, 0, &idx, &n_idx, -1, nullptr, -1, -1, -1); /* n_obj = -1 disables numbered tags */ } SelectorCreateResult_t SelectorCreateOrderedFromObjectIndices(PyMOLGlobals * G, const char *sname, ObjectMolecule * obj, int *idx, int n_idx) { - return _SelectorCreate(G, sname, NULL, &obj, true, NULL, NULL, 0, &idx, &n_idx, 0, NULL, -1, -1, -1); + return _SelectorCreate(G, sname, nullptr, &obj, true, nullptr, nullptr, 0, &idx, &n_idx, 0, nullptr, -1, -1, -1); /* assigned numbered tags */ } SelectorCreateResult_t SelectorCreate(PyMOLGlobals * G, const char *sname, const char *sele, ObjectMolecule * obj, int quiet, Multipick * mp) { - return _SelectorCreate(G, sname, sele, &obj, quiet, mp, NULL, 0, NULL, 0, 0, NULL, -1, + return _SelectorCreate(G, sname, sele, &obj, quiet, mp, nullptr, 0, nullptr, 0, 0, nullptr, -1, -1, -1); } @@ -6892,7 +6892,7 @@ SelectorCreateResult_t SelectorCreateWithStateDomain(PyMOLGlobals * G, const cha } } } - return _SelectorCreate(G, sname, sele, &obj, quiet, mp, NULL, 0, NULL, 0, 0, NULL, -1, + return _SelectorCreate(G, sname, sele, &obj, quiet, mp, nullptr, 0, nullptr, 0, 0, nullptr, -1, state, domain_sele); } @@ -7040,8 +7040,8 @@ int SelectorUpdateTableImpl(PyMOLGlobals * G, CSelector *I, int req_state, Selec ov_size c = 0; int modelCnt; int state = req_state; - void *iterator = NULL; - ObjectMolecule *obj = NULL; + void *iterator = nullptr; + ObjectMolecule *obj = nullptr; /* Origin and Center are dummy objects */ if(!I->Origin) @@ -7171,7 +7171,7 @@ int SelectorUpdateTableImpl(PyMOLGlobals * G, CSelector *I, int req_state, Selec if(state < obj->NCSet) cs = obj->CSet[state]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(a); if(idx >= 0) { @@ -7188,7 +7188,7 @@ int SelectorUpdateTableImpl(PyMOLGlobals * G, CSelector *I, int req_state, Selec if(state < obj->NCSet) cs = obj->CSet[state]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(a); if(idx >= 0) { @@ -7284,7 +7284,7 @@ static int SelectorModulate1(PyMOLGlobals * G, EvalElem * base, int state) if(d < obj->NCSet) cs = obj->CSet[d]; else - cs = NULL; + cs = nullptr; if(cs) { if (CoordSetGetAtomVertex(cs, at, coords[a])) { Flag1[a] = true; @@ -7308,7 +7308,7 @@ static int SelectorModulate1(PyMOLGlobals * G, EvalElem * base, int state) if(e < obj->NCSet) cs = obj->CSet[e]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(at); if(idx >= 0) { @@ -7384,7 +7384,7 @@ static int SelectorModulate1(PyMOLGlobals * G, EvalElem * base, int state) if(d < obj->NCSet) cs = obj->CSet[d]; else - cs = NULL; + cs = nullptr; if(cs) { if(CoordSetGetAtomVertex(cs, at, Vertex.data() + 3 * a)) { Flag1[a] = true; @@ -7408,7 +7408,7 @@ static int SelectorModulate1(PyMOLGlobals * G, EvalElem * base, int state) if(e < obj->NCSet) cs = obj->CSet[e]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(at); @@ -7459,7 +7459,7 @@ static int SelectorSelect0(PyMOLGlobals * G, EvalElem * passed_base) int a, b, flag; EvalElem *base = passed_base; int c = 0; - ObjectMolecule *obj, *cur_obj = NULL; + ObjectMolecule *obj, *cur_obj = nullptr; CoordSet *cs; base->type = STYP_LIST; @@ -7474,7 +7474,7 @@ static int SelectorSelect0(PyMOLGlobals * G, EvalElem * passed_base) { /* first, verify chemistry for all atoms... */ - ObjectMolecule *lastObj = NULL, *obj; + ObjectMolecule *lastObj = nullptr, *obj; for(a = cNDummyAtoms; a < I->Table.size(); a++) { obj = I->Obj[I->Table[a].model]; if(obj != lastObj) { @@ -7594,7 +7594,7 @@ static int SelectorSelect0(PyMOLGlobals * G, EvalElem * passed_base) break; case SELE_PREz: - cs = NULL; + cs = nullptr; for(a = cNDummyAtoms; a < I->Table.size(); a++) { base[0].sele[a] = false; obj = I->Obj[I->Table[a].model]; @@ -7636,7 +7636,7 @@ static int SelectorSelect0(PyMOLGlobals * G, EvalElem * passed_base) break; case SELE_VISz: { - ObjectMolecule *last_obj = NULL; + ObjectMolecule *last_obj = nullptr; AtomInfoType *ai; for(a = cNDummyAtoms; a < I->Table.size(); a++) { flag = false; @@ -7678,7 +7678,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu { CSelector *I = G->Selector; auto IM = I->mgr; - CWordMatcher *matcher = NULL; + CWordMatcher *matcher = nullptr; int a, b, c = 0, hit_flag; ObjectMolecule *obj, *last_obj; int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); @@ -7692,8 +7692,8 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu int rep_mask; const char *wildcard = SettingGetGlobal_s(G, cSetting_wildcard); - ObjectMolecule *cur_obj = NULL; - CoordSet *cs = NULL; + ObjectMolecule *cur_obj = nullptr; + CoordSet *cs = nullptr; base->type = STYP_LIST; base->sele_calloc(I_NAtom); /* starting with zeros */ @@ -7701,13 +7701,13 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu switch (base->code) { case SELE_PEPs: if(base[1].text()[0]) { - AtomInfoType *last_ai0 = NULL, *ai0; + AtomInfoType *last_ai0 = nullptr, *ai0; for(a = cNDummyAtoms; a < I_NAtom; a++) { ai0 = I->Obj[I->Table[a].model]->AtomInfo + I->Table[a].atom; if(!AtomInfoSameResidueP(G, ai0, last_ai0)) { /* new starting residue */ int match_found = false; const char *ch = base[1].text(); /* sequence argument */ - AtomInfoType *ai1, *last_ai1 = NULL; + AtomInfoType *ai1, *last_ai1 = nullptr; for(b = a; b < I_NAtom; b++) { ai1 = I->Obj[I->Table[b].model]->AtomInfo + I->Table[b].atom; if(!AtomInfoSameResidueP(G, ai1, last_ai1)) { @@ -7726,7 +7726,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu } if(match_found) { const char *ch = base[1].text(); /* sequence argument */ - AtomInfoType *ai1, *last_ai1 = NULL, *ai2; + AtomInfoType *ai1, *last_ai1 = nullptr, *ai2; for(b = a; b < I_NAtom; b++) { ai1 = I->Obj[I->Table[b].model]->AtomInfo + I->Table[b].atom; if(!AtomInfoSameResidueP(G, ai1, last_ai1)) { @@ -7832,7 +7832,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu matcher = WordMatcherNew(G, base[1].text(), &options, false); base_0_sele_a = &base[0].sele[cNDummyAtoms]; - last_obj = NULL; + last_obj = nullptr; for(a = cNDummyAtoms; a < I_NAtom; a++) { auto& table_a = I->Table[a]; obj = I->Obj[table_a.model]; @@ -7842,7 +7842,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu for handling nucleic acid structures that use "*" in atom names */ const char *atom_name_wildcard = - SettingGet_s(G, obj->Setting.get(), NULL, cSetting_atom_name_wildcard); + SettingGet_s(G, obj->Setting.get(), nullptr, cSetting_atom_name_wildcard); if(!atom_name_wildcard[0]) atom_name_wildcard = wildcard; @@ -8070,7 +8070,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu case SELE_STAs: sscanf(base[1].text(), "%d", &state); state = state - 1; - obj = NULL; + obj = nullptr; if (state < 0 && state != cSelectorUpdateTableCurrentState) { return pymol::make_error( @@ -8251,7 +8251,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu int group_list_id; if((group_list_id = ExecutiveGetExpandedGroupListFromPattern(G, word))) { int last_was_member = false; - last_obj = NULL; + last_obj = nullptr; for(a = cNDummyAtoms; a < I_NAtom; a++) { if(last_obj != I->Obj[I->Table[a].model]) { last_obj = I->Obj[I->Table[a].model]; @@ -8287,7 +8287,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu int group_list_id; if((group_list_id = ExecutiveGetExpandedGroupList(G, word))) { int last_was_member = false; - last_obj = NULL; + last_obj = nullptr; for(a = 0; a < I_NAtom; a++) /* zero out first before iterating through selections */ base[0].sele[a] = false; for(a = cNDummyAtoms; a < I_NAtom; a++) { @@ -8341,7 +8341,7 @@ static pymol::Result<> SelectorSelect1(PyMOLGlobals * G, EvalElem * base, int qu base[0].sele[a] = false; base_0_sele_a = &base[0].sele[cNDummyAtoms]; - last_obj = NULL; + last_obj = nullptr; for(a = cNDummyAtoms; a < I_NAtom; a++) { auto& table_a = I->Table[a]; obj = I->Obj[table_a.model]; @@ -8722,7 +8722,7 @@ static int SelectorLogic1(PyMOLGlobals * G, EvalElem * inp_base, int state) AtomInfoType *at1, *at2; int n_atom = I->Table.size(); int ignore_case = SettingGetGlobal_b(G, cSetting_ignore_case); - ObjectMolecule *lastObj = NULL; + ObjectMolecule *lastObj = nullptr; base[0].sele = std::move(base[1].sele); base[0].type = STYP_LIST; @@ -9119,7 +9119,7 @@ static int SelectorLogic1(PyMOLGlobals * G, EvalElem * inp_base, int state) if(d < obj->NCSet) cs = obj->CSet[d]; else - cs = NULL; + cs = nullptr; if(cs) { const auto* sym = cs->getSymmetry(); if (sym) { @@ -9149,7 +9149,7 @@ static int SelectorLogic1(PyMOLGlobals * G, EvalElem * inp_base, int state) if(e < obj->NCSet) cs = obj->CSet[e]; else - cs = NULL; + cs = nullptr; if(cs) { const auto* sym = cs->getSymmetry(); if (sym) { @@ -9407,7 +9407,7 @@ int SelectorOperator22(PyMOLGlobals * G, EvalElem * base, int state) if(d < obj->NCSet) cs = obj->CSet[d]; else - cs = NULL; + cs = nullptr; if(cs) { if(CoordSetGetAtomVertex(cs, at, coords[a])) { Flag1[a] = true; @@ -9430,7 +9430,7 @@ int SelectorOperator22(PyMOLGlobals * G, EvalElem * base, int state) if(e < obj->NCSet) cs = obj->CSet[e]; else - cs = NULL; + cs = nullptr; if(cs) { idx = cs->atmToIdx(at); if(idx >= 0) { @@ -9492,7 +9492,7 @@ static void remove_quotes(std::string& str) char *st = &str[0]; char *p, *q; - char *quote_start = NULL; + char *quote_start = nullptr; char active_quote = 0; p = st; q = st; @@ -9505,7 +9505,7 @@ static void remove_quotes(std::string& str) quote_start++; } q--; - quote_start = NULL; + quote_start = nullptr; p++; continue; } else if(quote_start) { @@ -10148,7 +10148,7 @@ DistSet *SelectorGetDistSet(PyMOLGlobals * G, DistSet * ds, int dist_cnt = 0; int s; int a_keeper = false; - int *zero = NULL, *scratch = NULL; + int *zero = nullptr, *scratch = nullptr; std::vector coverage; HBondCriteria hbcRec, *hbc; int exclusion = 0; @@ -10197,7 +10197,7 @@ DistSet *SelectorGetDistSet(PyMOLGlobals * G, DistSet * ds, /* find and prepare (neighbortables) in any participating Molecular objects */ if((mode == 1) || (mode == 2) || (mode == 3)) { /* fill in all the neighbor tables */ int max_n_atom = I->Table.size(); - lastObj = NULL; + lastObj = nullptr; for(a = cNDummyAtoms; a < I->Table.size(); a++) { /* foreach atom in the session, get its identifier and ObjectMolecule to which it belongs */ at = I->Table[a].atom; /* grab the atom ID from the Selectors->Table */ @@ -10316,8 +10316,8 @@ DistSet *SelectorGetDistSet(PyMOLGlobals * G, DistSet * ds, cs2 = obj2->CSet[state2]; if(cs1 && cs2) { /* for bonding */ - float *don_vv = NULL; - float *acc_vv = NULL; + float *don_vv = nullptr; + float *acc_vv = nullptr; /* grab the appropriate atom information for this object-local atom */ ai1 = obj1->AtomInfo + at1; @@ -10337,7 +10337,7 @@ DistSet *SelectorGetDistSet(PyMOLGlobals * G, DistSet * ds, /* if we pass the boding cutoff */ if(dist < cutoff) { float h_crd[3]; - h_ai = NULL; + h_ai = nullptr; a_keeper = true; if(exclusion && (obj1 == obj2)) { @@ -10682,7 +10682,7 @@ DistSet *SelectorGetDihedralSet(PyMOLGlobals * G, DistSet * ds, int nv = 0; std::vector coverage14; std::vector coverage23; - ObjectMolecule *just_one_object = NULL; + ObjectMolecule *just_one_object = nullptr; int just_one_atom[4] = { -1, -1, -1, -1 }; if(!ds) { @@ -10719,7 +10719,7 @@ DistSet *SelectorGetDihedralSet(PyMOLGlobals * G, DistSet * ds, s = obj->AtomInfo[at].selEntry; if(SelectorIsMember(G, s, sele1)) { if(obj != just_one_object) - just_one_object = NULL; + just_one_object = nullptr; else if(just_one_atom[0] == -1) just_one_atom[0] = a; else @@ -10728,7 +10728,7 @@ DistSet *SelectorGetDihedralSet(PyMOLGlobals * G, DistSet * ds, } if(SelectorIsMember(G, s, sele2)) { if(obj != just_one_object) - just_one_object = NULL; + just_one_object = nullptr; else if(just_one_atom[1] == -1) just_one_atom[1] = a; else @@ -10737,7 +10737,7 @@ DistSet *SelectorGetDihedralSet(PyMOLGlobals * G, DistSet * ds, } if(SelectorIsMember(G, s, sele3)) { if(obj != just_one_object) - just_one_object = NULL; + just_one_object = nullptr; else if(just_one_atom[2] == -1) just_one_atom[2] = a; else @@ -10746,7 +10746,7 @@ DistSet *SelectorGetDihedralSet(PyMOLGlobals * G, DistSet * ds, } if(SelectorIsMember(G, s, sele4)) { if(obj != just_one_object) - just_one_object = NULL; + just_one_object = nullptr; else if(just_one_atom[3] == -1) just_one_atom[3] = a; else diff --git a/layer4/Cmd.cpp b/layer4/Cmd.cpp index d110a2ca9..56fd0662d 100644 --- a/layer4/Cmd.cpp +++ b/layer4/Cmd.cpp @@ -154,7 +154,7 @@ static PyMOLGlobals * _api_get_pymol_globals(PyObject * self) { } \ } - return NULL; + return nullptr; } /** @@ -376,7 +376,7 @@ static PyObject *APIAutoNone(PyObject * result) { /* automatically owned Py_None */ if(result == Py_None) Py_INCREF(result); - else if(result == NULL) { + else if(result == nullptr) { result = Py_None; Py_INCREF(result); } @@ -385,13 +385,13 @@ static PyObject *APIAutoNone(PyObject * result) static PyObject *CmdGetModalDraw(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; int status = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -405,7 +405,7 @@ static PyObject *CmdGetModalDraw(PyObject * self, PyObject * args) static PyObject *CmdPseudoatom(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *object_name, *sele, *label; char *name, *resn, *resi, *chain, *segi, *elem; float vdw; @@ -418,7 +418,7 @@ static PyObject *CmdPseudoatom(PyObject * self, PyObject * args) &object_name, &sele, &name, &resn, &resi, &chain, &segi, &elem, &vdw, &hetatm, &b, &q, &label, &pos, &color, &state, &mode, &quiet); - float pos_array[3], *pos_ptr = NULL; + float pos_array[3], *pos_ptr = nullptr; if(pos && PyTuple_Check(pos) && (PyTuple_Size(pos) == 3)) if(PyArg_ParseTuple(pos, "fff", pos_array, pos_array + 1, pos_array + 2)) pos_ptr = pos_array; @@ -434,7 +434,7 @@ static PyObject *CmdPseudoatom(PyObject * self, PyObject * args) static PyObject *CmdFixChemistry(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str2, *str3; int quiet; int invalidate; @@ -447,7 +447,7 @@ static PyObject *CmdFixChemistry(PyObject * self, PyObject * args) static PyObject *CmdRayAntiThread(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *py_thread_info; API_SETUP_ARGS(G, self, args, "OO", &self, &py_thread_info); @@ -464,7 +464,7 @@ static PyObject *CmdRayAntiThread(PyObject * self, PyObject * args) static PyObject *CmdRayHashThread(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *py_thread_info; API_SETUP_ARGS(G, self, args, "OO", &self, &py_thread_info); @@ -481,7 +481,7 @@ static PyObject *CmdRayHashThread(PyObject * self, PyObject * args) static PyObject *CmdRayTraceThread(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *py_thread_info; API_SETUP_ARGS(G, self, args, "OO", &self, &py_thread_info); @@ -498,7 +498,7 @@ static PyObject *CmdRayTraceThread(PyObject * self, PyObject * args) static PyObject *CmdCoordSetUpdateThread(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *py_thread_info; API_SETUP_ARGS(G, self, args, "OO", &self, &py_thread_info); @@ -515,7 +515,7 @@ static PyObject *CmdCoordSetUpdateThread(PyObject * self, PyObject * args) static PyObject *CmdObjectUpdateThread(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *py_thread_info; API_SETUP_ARGS(G, self, args, "OO", &self, &py_thread_info); @@ -532,19 +532,19 @@ static PyObject *CmdObjectUpdateThread(PyObject * self, PyObject * args) static PyObject *CmdGetMovieLocked(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); return APIResultCode(MovieLocked(G)); } static PyObject *CmdFakeDrag(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -556,7 +556,7 @@ static PyObject *CmdFakeDrag(PyObject * self, PyObject * args) static PyObject *CmdDelColorection(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; PyObject *list; char *prefix; @@ -569,7 +569,7 @@ static PyObject *CmdDelColorection(PyObject * self, PyObject * args) static PyObject *CmdSetColorection(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; char *prefix; PyObject *list; @@ -582,8 +582,8 @@ static PyObject *CmdSetColorection(PyObject * self, PyObject * args) static PyObject *CmdGetColorection(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; const char* prefix; API_SETUP_ARGS(G, self, args, "Os", &self, &prefix); API_ASSERT(APIEnterBlockedNotModal(G)); @@ -611,7 +611,7 @@ static PyObject *CmdSetRawAlignment(PyObject * self, PyObject * args) static PyObject *CmdGetRawAlignment(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char *name; int active_only; int state = 0; @@ -625,14 +625,14 @@ static PyObject *CmdGetRawAlignment(PyObject * self, PyObject * args) static PyObject *CmdGetOrigin(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; float origin[3]; char *object; ok = PyArg_ParseTuple(args, "Os", &self, &object); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -664,8 +664,8 @@ static PyObject *CmdGetOrigin(PyObject * self, PyObject * args) static PyObject * CmdFindMolfilePlugin(PyObject * self, PyObject * args) { - PyMOLGlobals * G = NULL; - const char * ext = NULL; + PyMOLGlobals * G = nullptr; + const char * ext = nullptr; int mask = 0; if (!PyArg_ParseTuple(args, "Os|i", &self, &ext, &mask)) { API_HANDLE_ERROR; @@ -683,8 +683,8 @@ static PyObject * CmdFindMolfilePlugin(PyObject * self, PyObject * args) static PyObject * CmdGetCCP4Str(PyObject * self, PyObject * args) { - PyMOLGlobals * G = NULL; - const char * name = NULL; + PyMOLGlobals * G = nullptr; + const char * name = nullptr; int state = 0; int quiet = 1; int format = cLoadTypeCCP4Unspecified; @@ -695,7 +695,7 @@ static PyObject * CmdGetCCP4Str(PyObject * self, PyObject * args) if (G) { APIEnterBlocked(G); auto v = ObjectMapGetCCP4Str(G, name, state, quiet, format); - PyObject * result = v.empty() ? NULL : + PyObject * result = v.empty() ? nullptr : PyBytes_FromStringAndSize(&v.front(), v.size()); APIExitBlocked(G); @@ -707,8 +707,8 @@ static PyObject * CmdGetCCP4Str(PyObject * self, PyObject * args) static PyObject * CmdGetVolumeField(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int state = 0; int ok = false; char* objName; @@ -717,7 +717,7 @@ static PyObject * CmdGetVolumeField(PyObject * self, PyObject * args) if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -737,7 +737,7 @@ static PyObject * CmdGetVolumeField(PyObject * self, PyObject * args) static PyObject * CmdGetVolumeHistogram(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char* objName; float min_val = 0.f, max_val = 0.f; int n_points = 64; @@ -753,8 +753,8 @@ static PyObject * CmdGetVolumeHistogram(PyObject * self, PyObject * args) static PyObject * CmdGetVolumeRamp(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int ok = false; char* objName; int state; @@ -762,7 +762,7 @@ static PyObject * CmdGetVolumeRamp(PyObject * self, PyObject * args) if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -779,7 +779,7 @@ static PyObject * CmdGetVolumeRamp(PyObject * self, PyObject * args) static PyObject * CmdSetVolumeRamp(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char* objName; PyObject *ramp_list; std::vector float_array; @@ -801,8 +801,8 @@ static PyObject * CmdSetVolumeRamp(PyObject * self, PyObject * args) static PyObject *CmdGetVis(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); API_ASSERT(APIEnterBlockedNotModal(G)); result = ExecutiveGetVisAsPyDict(G); @@ -812,7 +812,7 @@ static PyObject *CmdGetVis(PyObject * self, PyObject * args) static PyObject *CmdSetVis(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; PyObject *visDict; API_SETUP_ARGS(G, self, args, "OO", &self, &visDict); @@ -824,7 +824,7 @@ static PyObject *CmdSetVis(PyObject * self, PyObject * args) static PyObject *CmdReinitialize(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int what; char *object; API_SETUP_ARGS(G, self, args, "Ois", &self, &what, &object); @@ -836,7 +836,7 @@ static PyObject *CmdReinitialize(PyObject * self, PyObject * args) static PyObject *CmdSpectrum(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *expr, *prefix; float min, max; int digits, start, stop, byres; @@ -854,12 +854,12 @@ static PyObject *CmdSpectrum(PyObject * self, PyObject * args) static PyObject *CmdMDump(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -873,12 +873,12 @@ static PyObject *CmdMDump(PyObject * self, PyObject * args) static PyObject *CmdAccept(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -894,12 +894,12 @@ static PyObject *CmdAccept(PyObject * self, PyObject * args) static PyObject *CmdDecline(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -915,7 +915,7 @@ static PyObject *CmdDecline(PyObject * self, PyObject * args) static PyObject *CmdSetSymmetry(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int state; float a, b, c, alpha, beta, gamma; @@ -932,7 +932,7 @@ static PyObject *CmdSetSymmetry(PyObject * self, PyObject * args) static PyObject *CmdGetSymmetry(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; float a, b, c, alpha, beta, gamma; int state; @@ -957,7 +957,7 @@ static PyObject *CmdGetSymmetry(PyObject * self, PyObject * args) static PyObject *CmdSmooth(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sele; int cycles, window, first, last, ends, quiet; float cutoff = -1; @@ -973,7 +973,7 @@ static PyObject *CmdSmooth(PyObject * self, PyObject * args) static PyObject *CmdGetSession(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *dict; int partial, quiet; const char* names; @@ -1010,7 +1010,7 @@ static PyObject *CmdGetSession(PyObject * self, PyObject * args) static PyObject *CmdSetSession(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int quiet, partial; PyObject *obj; API_SETUP_ARGS(G, self, args, "OOii", &self, &obj, &partial, &quiet); @@ -1022,7 +1022,7 @@ static PyObject *CmdSetSession(PyObject * self, PyObject * args) static PyObject *CmdSetName(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; API_SETUP_ARGS(G, self, args, "Oss", &self, &str1, &str2); API_ASSERT(APIEnterNotModal(G)); @@ -1036,17 +1036,17 @@ static PyObject *CmdSetName(PyObject * self, PyObject * args) static PyObject *CmdGetBondPrint(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; char *str1; - int ***array = NULL; - PyObject *result = NULL; + int ***array = nullptr; + PyObject *result = nullptr; int int1, int2; int dim[3]; ok = PyArg_ParseTuple(args, "Osii", &self, &str1, &int1, &int2); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1063,13 +1063,13 @@ static PyObject *CmdGetBondPrint(PyObject * self, PyObject * args) static PyObject *CmdDebug(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; char *str1; ok = PyArg_ParseTuple(args, "Os", &self, &str1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1082,12 +1082,12 @@ static PyObject *CmdDebug(PyObject * self, PyObject * args) static PyObject *CmdSculptPurge(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1103,7 +1103,7 @@ static PyObject *CmdScene(PyObject * self, PyObject * args) PyMOLGlobals *G = nullptr; MovieSceneFuncArgs margs; - const char *key, *action, *message = NULL, *new_key = NULL; + const char *key, *action, *message = nullptr, *new_key = nullptr; const char * sele = "all"; API_SETUP_ARGS(G, self, args, "Oss|zbbbbbfzbbs", &self, &key, &action, @@ -1123,7 +1123,7 @@ static PyObject *CmdScene(PyObject * self, PyObject * args) static PyObject *CmdSceneOrder(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char *location; unsigned char sort; @@ -1144,8 +1144,8 @@ static PyObject *CmdSceneOrder(PyObject * self, PyObject * args) static PyObject *CmdGetSceneOrder(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject * result = NULL; + PyMOLGlobals *G = nullptr; + PyObject * result = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); APIEnterBlocked(G); @@ -1210,13 +1210,13 @@ static PyObject* CmdSetSceneMessage(PyObject* self, PyObject* args) static PyObject *CmdSculptDeactivate(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; char *str1; ok = PyArg_ParseTuple(args, "Os", &self, &str1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1229,14 +1229,14 @@ static PyObject *CmdSculptDeactivate(PyObject * self, PyObject * args) static PyObject *CmdSculptActivate(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; int int1, int2, int3; char *str1; ok = PyArg_ParseTuple(args, "Osiii", &self, &str1, &int1, &int2, &int3); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1249,7 +1249,7 @@ static PyObject *CmdSculptActivate(PyObject * self, PyObject * args) static PyObject *CmdSculptIterate(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; int int1, int2; char *str1; @@ -1257,7 +1257,7 @@ static PyObject *CmdSculptIterate(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Osii", &self, &str1, &int1, &int2); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1270,7 +1270,7 @@ static PyObject *CmdSculptIterate(PyObject * self, PyObject * args) static PyObject *CmdSetObjectTTT(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float ttt[16]; int quiet; char *name; @@ -1290,7 +1290,7 @@ static PyObject *CmdSetObjectTTT(PyObject * self, PyObject * args) static PyObject *CmdTranslateObjectTTT(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float mov[3]; char *name; API_SETUP_ARGS(G, self, args, "Os(fff)", @@ -1304,7 +1304,7 @@ static PyObject *CmdTranslateObjectTTT(PyObject * self, PyObject * args) static PyObject *CmdCombineObjectTTT(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; PyObject *m; float ttt[16]; @@ -1320,13 +1320,13 @@ static PyObject *CmdCombineObjectTTT(PyObject * self, PyObject * args) static PyObject *CmdGetColor(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int mode; int a, nc, nvc; const float *rgb; int index; - PyObject *result = NULL; + PyObject *result = nullptr; API_SETUP_ARGS(G, self, args, "Osi", &self, &name, &mode); APIEnterBlocked(G); { @@ -1406,7 +1406,7 @@ static PyObject* CmdCurveNew(PyObject* self, PyObject* args) static PyObject *CmdGetChains(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1; @@ -1437,15 +1437,15 @@ static PyObject *CmdGetClickString(PyObject * self, PyObject * args) static PyObject *CmdRampNew(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int ok = false; char *map; int state; char *sele; float beyond, within; - float sigma, *range_vla = NULL; - float *color_vla = NULL; + float sigma, *range_vla = nullptr; + float *color_vla = nullptr; int zero, quiet, calc_mode = 0; PyObject *range, *color; API_SETUP_ARGS(G, self, args, "OssOOisfffii", &self, &name, &map, &range, &color, @@ -1478,11 +1478,11 @@ static PyObject *CmdRampNew(PyObject * self, PyObject * args) /* See MapCalculate for the actual calculation */ static PyObject * CmdMapGenerate(PyObject * self, PyObject * args) { - PyMOLGlobals * G = NULL; + PyMOLGlobals * G = nullptr; int ok = false; char * name, * reflection_file, * tempFile, * amplitudes, * phases, * weights, *space_group; - const char * cResult = NULL; + const char * cResult = nullptr; int quiet, zoom; double reso_high, reso_low, cell[6]; @@ -1494,7 +1494,7 @@ static PyObject * CmdMapGenerate(PyObject * self, PyObject * args) if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1523,7 +1523,7 @@ static PyObject * CmdMapGenerate(PyObject * self, PyObject * args) static PyObject *CmdMapNew(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; float minCorner[3], maxCorner[3]; float grid; @@ -1550,7 +1550,7 @@ static PyObject *CmdMapNew(PyObject * self, PyObject * args) static PyObject *CmdMapSetBorder(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; float level; int state; @@ -1558,7 +1558,7 @@ static PyObject *CmdMapSetBorder(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Osfi", &self, &name, &level, &state); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1571,7 +1571,7 @@ static PyObject *CmdMapSetBorder(PyObject * self, PyObject * args) static PyObject *CmdMapSet(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name, *operands; int target_state, source_state, operator_; int zoom, quiet; @@ -1587,7 +1587,7 @@ static PyObject *CmdMapSet(PyObject * self, PyObject * args) static PyObject *CmdMapTrim(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name, *sele; int map_state, sele_state; float buffer; @@ -1602,7 +1602,7 @@ static PyObject *CmdMapTrim(PyObject * self, PyObject * args) static PyObject *CmdMapDouble(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int state; API_SETUP_ARGS(G, self, args, "Osi", &self, &name, &state); @@ -1614,7 +1614,7 @@ static PyObject *CmdMapDouble(PyObject * self, PyObject * args) static PyObject *CmdMapHalve(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int state; int smooth; @@ -1627,8 +1627,8 @@ static PyObject *CmdMapHalve(PyObject * self, PyObject * args) static PyObject *CmdGetRenderer(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - char *vendor = NULL, *renderer = NULL, *version = NULL; + PyMOLGlobals *G = nullptr; + char *vendor = nullptr, *renderer = nullptr, *version = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); APIEnter(G); SceneGetCardInfo(G, &vendor, &renderer, &version); @@ -1718,7 +1718,7 @@ static PyObject* CmdGetCapabilities(PyObject*, PyObject*) static PyObject *CmdTranslateAtom(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state, log, mode; float v[3]; @@ -1732,7 +1732,7 @@ static PyObject *CmdTranslateAtom(PyObject * self, PyObject * args) static PyObject *CmdMatrixCopy(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *source_name, *target_name; int source_mode, target_mode; int source_state, target_state, target_undo; @@ -1750,7 +1750,7 @@ static PyObject *CmdMatrixCopy(PyObject * self, PyObject * args) static PyObject *CmdResetMatrix(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int mode; int state; @@ -1765,7 +1765,7 @@ static PyObject *CmdResetMatrix(PyObject * self, PyObject * args) static PyObject *CmdTransformObject(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name, *sele; int state, log; PyObject *m; @@ -1784,7 +1784,7 @@ static PyObject *CmdTransformObject(PyObject * self, PyObject * args) static PyObject *CmdTransformSelection(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sele; int state, log; int homo; @@ -1802,7 +1802,7 @@ static PyObject *CmdTransformSelection(PyObject * self, PyObject * args) static PyObject *CmdLoadColorTable(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char* str1; float gamma; int quiet; @@ -1815,7 +1815,7 @@ static PyObject *CmdLoadColorTable(PyObject * self, PyObject * args) static PyObject *CmdLoadPNG(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int ok = false; int quiet; @@ -1829,7 +1829,7 @@ static PyObject *CmdLoadPNG(PyObject * self, PyObject * args) static PyObject *CmdBackgroundColor(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; API_SETUP_ARGS(G, self, args, "Os", &self, &str1); API_ASSERT(APIEnterNotModal(G)); @@ -1840,7 +1840,7 @@ static PyObject *CmdBackgroundColor(PyObject * self, PyObject * args) static PyObject *CmdGetPosition(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float v[3] = { 0.0F, 0.0F, 0.0F }; API_SETUP_ARGS(G, self, args, "O", &self); APIEnter(G); @@ -1851,13 +1851,13 @@ static PyObject *CmdGetPosition(PyObject * self, PyObject * args) static PyObject *CmdGetMoviePlaying(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self);; if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); result = PyInt_FromLong(MoviePlaying(G)); } else { API_HANDLE_ERROR; @@ -1867,7 +1867,7 @@ static PyObject *CmdGetMoviePlaying(PyObject * self, PyObject * args) static PyObject *CmdGetPhiPsi(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state; PyObject *result = Py_None; @@ -1899,7 +1899,7 @@ static PyObject *CmdGetPhiPsi(PyObject * self, PyObject * args) static PyObject *CmdAlign(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str2, *str3, *mfile, *oname; OrthoLineType s2 = "", s3 = ""; int ok = false; @@ -1918,7 +1918,7 @@ static PyObject *CmdAlign(PyObject * self, PyObject * args) if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -1955,11 +1955,11 @@ static PyObject *CmdAlign(PyObject * self, PyObject * args) static PyObject *CmdGetCoordsAsNumPy(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state = 0; OrthoLineType s1; - PyObject *result = NULL; + PyObject *result = nullptr; API_SETUP_ARGS(G, self, args, "Os|i", &self, &str1, &state); API_ASSERT(str1[0]); @@ -1979,8 +1979,8 @@ static PyObject *CmdGetCoordsAsNumPy(PyObject * self, PyObject * args) static PyObject *CmdGetCoordSetAsNumPy(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; CoordSet *cs; int state = 0; char *name; @@ -2004,8 +2004,8 @@ static PyObject *CmdGetCoordSetAsNumPy(PyObject * self, PyObject * args) static PyObject *CmdGetSettingUpdates(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int state; char *name; @@ -2031,7 +2031,7 @@ static PyObject *CmdGetSettingIndices(PyObject * self, PyObject * args) static PyObject *CmdGetView(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; SceneViewType view; API_SETUP_ARGS(G, self, args, "O", &self); { @@ -2053,7 +2053,7 @@ static PyObject *CmdGetView(PyObject * self, PyObject * args) static PyObject *CmdGetViewPort(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int width, height; API_SETUP_ARGS(G, self, args, "O", &self); APIEnter(G); @@ -2064,7 +2064,7 @@ static PyObject *CmdGetViewPort(PyObject * self, PyObject * args) static PyObject *CmdSetView(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; SceneViewType view; int quiet; float animate; @@ -2088,13 +2088,13 @@ static PyObject *CmdSetView(PyObject * self, PyObject * args) static PyObject *CmdGetState(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int result = 0; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2106,13 +2106,13 @@ static PyObject *CmdGetState(PyObject * self, PyObject * args) static PyObject *CmdGetEditorScheme(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int result = 0; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2124,13 +2124,13 @@ static PyObject *CmdGetEditorScheme(PyObject * self, PyObject * args) static PyObject *CmdGetFrame(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int result = 0; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2142,7 +2142,7 @@ static PyObject *CmdGetFrame(PyObject * self, PyObject * args) static PyObject *CmdSetTitle(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int int1; API_SETUP_ARGS(G, self, args, "Osis", &self, &str1, &int1, &str2); @@ -2154,7 +2154,7 @@ static PyObject *CmdSetTitle(PyObject * self, PyObject * args) static PyObject *CmdGetTitle(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1; PyObject *result = Py_None; @@ -2169,7 +2169,7 @@ static PyObject *CmdGetTitle(PyObject * self, PyObject * args) static PyObject *CmdGetArea(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1, int2; API_SETUP_ARGS(G, self, args, "Osii", &self, &str1, &int1, &int2); @@ -2181,7 +2181,7 @@ static PyObject *CmdGetArea(PyObject * self, PyObject * args) static PyObject *CmdPushUndo(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str0; int state; OrthoLineType s0 = ""; @@ -2189,7 +2189,7 @@ static PyObject *CmdPushUndo(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Osi", &self, &str0, &state); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2207,7 +2207,7 @@ static PyObject *CmdPushUndo(PyObject * self, PyObject * args) static PyObject *CmdGetType(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; API_SETUP_ARGS(G, self, args, "Os", &self, &str1); APIEnter(G); @@ -2218,9 +2218,9 @@ static PyObject *CmdGetType(PyObject * self, PyObject * args) static PyObject *CmdGetObjectSettings(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - pymol::CObject *obj = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + pymol::CObject *obj = nullptr; + PyObject *result = nullptr; const char *oname; int state = -1; @@ -2244,7 +2244,7 @@ static PyObject *CmdGetObjectSettings(PyObject * self, PyObject * args) auto handle_state = obj->getSettingHandle(state); // only accept handle if different from object-level settings - handle = (handle_state == handle) ? NULL : handle_state; + handle = (handle_state == handle) ? nullptr : handle_state; } if (handle) { @@ -2259,14 +2259,14 @@ static PyObject *CmdGetObjectSettings(PyObject * self, PyObject * args) static PyObject *CmdGetUnusedName(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - char * prefix = NULL; + PyMOLGlobals *G = nullptr; + char * prefix = nullptr; int alwaysnumber = false; int ok = false; ok = PyArg_ParseTuple(args, "Osi", &self, &prefix, &alwaysnumber); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2281,18 +2281,18 @@ static PyObject *CmdGetUnusedName(PyObject * self, PyObject * args) static PyObject *CmdGetDragObjectName(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *result = Py_None; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } if(ok) { - char *name = NULL; + char *name = nullptr; APIEnter(G); { pymol::CObject *obj = EditorDragObject(G); @@ -2310,7 +2310,7 @@ static PyObject *CmdGetDragObjectName(PyObject * self, PyObject * args) static PyObject *CmdGetLegalName(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; WordType name; char *str0; API_SETUP_ARGS(G, self, args, "Os", &self, &str0); @@ -2323,7 +2323,7 @@ static PyObject *CmdGetLegalName(PyObject * self, PyObject * args) static PyObject *CmdGetNames(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1, int2; char *str0; API_SETUP_ARGS(G, self, args, "Oiis", &self, &int1, &int2, &str0); @@ -2335,13 +2335,13 @@ static PyObject *CmdGetNames(PyObject * self, PyObject * args) static PyObject *CmdInterrupt(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1; int ok = false; ok = PyArg_ParseTuple(args, "Oi", &self, &int1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2353,7 +2353,7 @@ static PyObject *CmdInterrupt(PyObject * self, PyObject * args) static PyObject *CmdInvert(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1; API_SETUP_ARGS(G, self, args, "Oi", &self, &int1); API_ASSERT(APIEnterNotModal(G)); @@ -2364,7 +2364,7 @@ static PyObject *CmdInvert(PyObject * self, PyObject * args) static PyObject *CmdTorsion(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float float1; API_SETUP_ARGS(G, self, args, "Of", &self, &float1); API_ASSERT(APIEnterNotModal(G)); @@ -2375,13 +2375,13 @@ static PyObject *CmdTorsion(PyObject * self, PyObject * args) static PyObject *CmdUndo(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1; int ok = false; ok = PyArg_ParseTuple(args, "Oi", &self, &int1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2394,7 +2394,7 @@ static PyObject *CmdUndo(PyObject * self, PyObject * args) static PyObject *CmdMask(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1, quiet; @@ -2407,7 +2407,7 @@ static PyObject *CmdMask(PyObject * self, PyObject * args) static PyObject *CmdProtect(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1, int2; @@ -2420,13 +2420,13 @@ static PyObject *CmdProtect(PyObject * self, PyObject * args) static PyObject *CmdButton(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int i1, i2; int ok = false; ok = PyArg_ParseTuple(args, "Oii", &self, &i1, &i2); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2439,13 +2439,13 @@ static PyObject *CmdButton(PyObject * self, PyObject * args) static PyObject *CmdFeedback(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int i1, i2, result = 0; int ok = false; ok = PyArg_ParseTuple(args, "Oii", &self, &i1, &i2); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2459,7 +2459,7 @@ static PyObject *CmdFeedback(PyObject * self, PyObject * args) static PyObject *CmdSetFeedbackMask(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int i1, i2, i3; API_SETUP_ARGS(G, self, args, "Oiii", &self, &i1, &i2, &i3); API_ASSERT(APIEnterNotModal(G)); @@ -2471,7 +2471,7 @@ static PyObject *CmdSetFeedbackMask(PyObject * self, PyObject * args) static PyObject *CmdPop(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int quiet; int result = 0; @@ -2479,7 +2479,7 @@ static PyObject *CmdPop(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Ossi", &self, &str1, &str2, &quiet); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2494,12 +2494,12 @@ static PyObject *CmdPop(PyObject * self, PyObject * args) static PyObject *CmdFlushNow(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self);; if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2519,14 +2519,14 @@ static PyObject *CmdFlushNow(PyObject * self, PyObject * args) static PyObject *CmdWaitQueue(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self);; if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2553,13 +2553,13 @@ static PyObject *CmdWaitQueue(PyObject * self, PyObject * args) static PyObject *CmdWaitDeferred(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self);; if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2579,7 +2579,7 @@ static PyObject *CmdWaitDeferred(PyObject * self, PyObject * args) static PyObject *CmdPaste(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *list, *str; const char *st; int l, a; @@ -2587,7 +2587,7 @@ static PyObject *CmdPaste(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "OO", &self, &list); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2621,15 +2621,15 @@ static PyObject *CmdPaste(PyObject * self, PyObject * args) static PyObject *CmdGetVRML(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int ver; API_SETUP_ARGS(G, self, args, "Oi", &self, &ver); { - char *vla = NULL; + char *vla = nullptr; API_ASSERT(APIEnterNotModal(G)); SceneRay(G, 0, 0, (ver == 1) ? 6 : 4, /* VRML1 or 2? */ - NULL, &vla, 0.0F, 0.0F, false, NULL, false, -1); + nullptr, &vla, 0.0F, 0.0F, false, nullptr, false, -1); APIExit(G); if(vla) { result = Py_BuildValue("s", vla); @@ -2644,16 +2644,16 @@ static PyObject *CmdGetVRML(PyObject * self, PyObject * args) */ static PyObject *CmdGetCOLLADA(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; int ver; - char *vla = NULL; + char *vla = nullptr; API_SETUP_ARGS(G, self, args, "Oi", &self, &ver); API_ASSERT(APIEnterNotModal(G)); SceneRay(G, 0, 0, 8, /* mode 8 = COLLADA */ - NULL, &vla, 0.0F, 0.0F, false, NULL, false, -1); + nullptr, &vla, 0.0F, 0.0F, false, nullptr, false, -1); APIExit(G); if (vla && vla[0]) { @@ -2668,14 +2668,14 @@ static PyObject *CmdGetCOLLADA(PyObject * self, PyObject * args) static PyObject *CmdGetIdtf(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); { - char *node = NULL, *rsrc = NULL; + char *node = nullptr, *rsrc = nullptr; API_ASSERT(APIEnterNotModal(G)); SceneRay(G, 0, 0, cSceneRay_MODE_IDTF, - &node, &rsrc, 0.0F, 0.0F, false, NULL, false, -1); + &node, &rsrc, 0.0F, 0.0F, false, nullptr, false, -1); APIExit(G); if(node && rsrc) { result = Py_BuildValue("(ss)", node, rsrc); @@ -2688,13 +2688,13 @@ static PyObject *CmdGetIdtf(PyObject * self, PyObject * args) static PyObject *CmdGetPovRay(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); { - char *header = NULL, *geom = NULL; + char *header = nullptr, *geom = nullptr; API_ASSERT(APIEnterNotModal(G)); - SceneRay(G, 0, 0, 1, &header, &geom, 0.0F, 0.0F, false, NULL, false, -1); + SceneRay(G, 0, 0, 1, &header, &geom, 0.0F, 0.0F, false, nullptr, false, -1); APIExit(G); if(header && geom) { result = Py_BuildValue("(ss)", header, geom); @@ -2707,13 +2707,13 @@ static PyObject *CmdGetPovRay(PyObject * self, PyObject * args) static PyObject *CmdGetMtlObj(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); { - char *obj = NULL, *mtl = NULL; + char *obj = nullptr, *mtl = nullptr; API_ASSERT(APIEnterNotModal(G)); - SceneRay(G, 0, 0, 5, &obj, &mtl, 0.0F, 0.0F, false, NULL, false, -1); + SceneRay(G, 0, 0, 5, &obj, &mtl, 0.0F, 0.0F, false, nullptr, false, -1); APIExit(G); if(obj && mtl) { result = Py_BuildValue("(ss)", mtl, obj); @@ -2798,14 +2798,14 @@ static PyObject *CmdDirtyWizard(PyObject * self, PyObject * args) static PyObject *CmdSplash(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int query; int result = 1; int ok = false; ok = PyArg_ParseTuple(args, "Oi", &self, &query); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2830,12 +2830,12 @@ static PyObject *CmdSplash(PyObject * self, PyObject * args) static PyObject *CmdCls(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2848,14 +2848,14 @@ static PyObject *CmdCls(PyObject * self, PyObject * args) static PyObject *CmdDump(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int state, quiet; int ok = false; ok = PyArg_ParseTuple(args, "Ossii", &self, &str1, &str2, &state, &quiet); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2868,7 +2868,7 @@ static PyObject *CmdDump(PyObject * self, PyObject * args) static PyObject *CmdIsomesh(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *mesh_name, *map_name, *sele; float lvl, fbuf, alt_lvl; int mesh_mode; @@ -2888,7 +2888,7 @@ static PyObject *CmdIsomesh(PyObject * self, PyObject * args) static PyObject *CmdSliceNew(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *slice; char *map; int state, map_state; @@ -2902,7 +2902,7 @@ static PyObject *CmdSliceNew(PyObject * self, PyObject * args) static PyObject *CmdIsosurface(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *surf_name, *map_name, *sele; float lvl, fbuf; int surf_mode; @@ -2924,7 +2924,7 @@ static PyObject *CmdIsosurface(PyObject * self, PyObject * args) static PyObject *CmdSymExp(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2, *str3; float cutoff; pymol::CObject *mObj; @@ -2937,7 +2937,7 @@ static PyObject *CmdSymExp(PyObject * self, PyObject * args) PyArg_ParseTuple(args, "Osssfii", &self, &str1, &str2, &str3, &cutoff, &segi, &quiet); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -2945,7 +2945,7 @@ static PyObject *CmdSymExp(PyObject * self, PyObject * args) mObj = ExecutiveFindObjectByName(G, str2); if(mObj) { if(mObj->type != cObjectMolecule) { - mObj = NULL; + mObj = nullptr; ok = false; } } @@ -2959,7 +2959,7 @@ static PyObject *CmdSymExp(PyObject * self, PyObject * args) static PyObject *CmdSymmetryCopy(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *source_name, *target_name; int source_state, target_state; int quiet; @@ -2976,7 +2976,7 @@ static PyObject *CmdSymmetryCopy(PyObject * self, PyObject * args) static PyObject *CmdOverlap(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int state1, state2; float overlap = -1.0; @@ -2985,7 +2985,7 @@ static PyObject *CmdOverlap(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Ossiif", &self, &str1, &str2, &state1, &state2, &adjust); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -3001,7 +3001,7 @@ static PyObject *CmdOverlap(PyObject * self, PyObject * args) static PyObject *CmdDist(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name, *str1, *str2; float cutoff; int labels, quiet; @@ -3018,7 +3018,7 @@ static PyObject *CmdDist(PyObject * self, PyObject * args) static PyObject *CmdAngle(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name, *str1, *str2, *str3; int labels, quiet; int mode; @@ -3038,7 +3038,7 @@ static PyObject *CmdAngle(PyObject * self, PyObject * args) static PyObject *CmdDihedral(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name, *str1, *str2, *str3, *str4; int labels, quiet; int mode; @@ -3055,7 +3055,7 @@ static PyObject *CmdDihedral(PyObject * self, PyObject * args) static PyObject *CmdBond(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int order, mode; int quiet; @@ -3097,7 +3097,7 @@ static PyObject* CmdRebond(PyObject* self, PyObject* args) static PyObject *CmdRevalence(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sele1, *sele2, *source; int source_state, target_state, reset; int quiet; @@ -3158,7 +3158,7 @@ static PyObject* CmdPBCWrap(PyObject* self, PyObject* args) static PyObject *CmdVdwFit(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int state1, state2, quiet; float buffer; @@ -3168,7 +3168,7 @@ static PyObject *CmdVdwFit(PyObject * self, PyObject * args) &quiet); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -3181,7 +3181,7 @@ static PyObject *CmdVdwFit(PyObject * self, PyObject * args) static PyObject *CmdLabel(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int quiet; API_SETUP_ARGS(G, self, args, "Ossi", &self, &str1, &str2, &quiet); @@ -3196,7 +3196,7 @@ static PyObject *CmdLabel(PyObject * self, PyObject * args) static PyObject *CmdLabel2(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int quiet; API_SETUP_ARGS(G, self, args, "Ossi", &self, &str1, &str2, &quiet); @@ -3208,7 +3208,7 @@ static PyObject *CmdLabel2(PyObject * self, PyObject * args) static PyObject *CmdAlter(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int read_only, quiet; PyObject *space; @@ -3228,7 +3228,7 @@ static PyObject *CmdAlter(PyObject * self, PyObject * args) static PyObject *CmdAlterList(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int quiet; PyObject *space; @@ -3242,7 +3242,7 @@ static PyObject *CmdAlterList(PyObject * self, PyObject * args) static PyObject *CmdSelectList(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *sele_name; int quiet; int mode; @@ -3263,7 +3263,7 @@ static PyObject *CmdSelectList(PyObject * self, PyObject * args) static PyObject *CmdAlterState(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int state, read_only, quiet; PyObject *obj; @@ -3276,7 +3276,7 @@ static PyObject *CmdAlterState(PyObject * self, PyObject * args) static PyObject *CmdCopy(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int zoom; API_SETUP_ARGS(G, self, args, "Ossi", &self, &str1, &str2, &zoom); @@ -3288,7 +3288,7 @@ static PyObject *CmdCopy(PyObject * self, PyObject * args) static PyObject *CmdRecolor(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; cRep_t rep; API_SETUP_ARGS(G, self, args, "Osi", &self, &str1, &rep); @@ -3300,7 +3300,7 @@ static PyObject *CmdRecolor(PyObject * self, PyObject * args) static PyObject *CmdRebuild(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char* str1; cRep_t rep; API_SETUP_ARGS(G, self, args, "Osi", &self, &str1, &rep); @@ -3322,7 +3322,7 @@ static PyObject *CmdRebuild(PyObject * self, PyObject * args) static PyObject *CmdResetRate(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); API_ASSERT(APIEnterNotModal(G)); ButModeResetRate(G); @@ -3332,12 +3332,12 @@ static PyObject *CmdResetRate(PyObject * self, PyObject * args) static PyObject *CmdReady(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -3350,12 +3350,12 @@ static PyObject *CmdReady(PyObject * self, PyObject * args) static PyObject *CmdMem(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -3402,7 +3402,7 @@ static void PyMOLGlobalsCapsuleDestructor(PyObject* self) */ static PyObject *Cmd_New(PyObject * self, PyObject * args) { - PyObject *pymol = NULL; /* pymol object instance */ + PyObject *pymol = nullptr; /* pymol object instance */ PyObject *pyoptions = Py_None; int singleton = false; @@ -3460,8 +3460,8 @@ static PyObject *Cmd_New(PyObject * self, PyObject * args) static PyObject *Cmd_Start(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *cmd = NULL; + PyMOLGlobals *G = nullptr; + PyObject *cmd = nullptr; int ok = true; ok = PyArg_ParseTuple(args, "OO", &self, &cmd); if(ok) { @@ -3479,7 +3479,7 @@ static PyObject *Cmd_Start(PyObject * self, PyObject * args) static PyObject *Cmd_Stop(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = true; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { @@ -3496,7 +3496,7 @@ static PyObject *Cmd_Stop(PyObject * self, PyObject * args) static PyObject *Cmd_Idle(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = true; int result = false; ok = PyArg_ParseTuple(args, "O", &self); @@ -3515,7 +3515,7 @@ static PyObject *Cmd_Idle(PyObject * self, PyObject * args) static PyObject *Cmd_Reshape(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = true; int width, height, force; ok = PyArg_ParseTuple(args, "Oiii", &self, &width, &height, &force); @@ -3534,7 +3534,7 @@ static PyObject *Cmd_Reshape(PyObject * self, PyObject * args) static PyObject *Cmd_GetRedisplay(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = true; int result = false; int reset; @@ -3554,7 +3554,7 @@ static PyObject *Cmd_GetRedisplay(PyObject * self, PyObject * args) static PyObject *Cmd_Draw(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = true; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { @@ -3572,7 +3572,7 @@ static PyObject *Cmd_Draw(PyObject * self, PyObject * args) static PyObject *Cmd_Button(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = true; int button, state; int x, y, modifiers; @@ -3592,7 +3592,7 @@ static PyObject *Cmd_Button(PyObject * self, PyObject * args) static PyObject *Cmd_Drag(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = true; int x, y, modifiers; ok = PyArg_ParseTuple(args, "Oiii", &self, &x, &y, &modifiers); @@ -3611,13 +3611,13 @@ static PyObject *Cmd_Drag(PyObject * self, PyObject * args) static PyObject *Cmd_Sdof(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float tx, ty, tz, rx, ry, rz; int ok = false; ok = PyArg_ParseTuple(args, "Offffff", &self, &tx, &ty, &tz, &rx, &ry, &rz); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -3655,7 +3655,7 @@ static PyObject *CmdRunPyMOL(PyObject * self, PyObject * args) static PyObject *CmdCountStates(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; OrthoLineType s1; int ok = false; @@ -3673,18 +3673,18 @@ static PyObject *CmdCountStates(PyObject * self, PyObject * args) static PyObject *CmdCountFrames(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); APIEnter(G); SceneCountFrames(G); - int result = SceneGetNFrame(G, NULL); + int result = SceneGetNFrame(G, nullptr); APIExit(G); return (APIResultCode(result)); } static PyObject *CmdGetMovieLength(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int result = 0; API_SETUP_ARGS(G, self, args, "O", &self); APIEnter(G); @@ -3695,7 +3695,7 @@ static PyObject *CmdGetMovieLength(PyObject * self, PyObject * args) static PyObject *CmdIdentify(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int mode; PyObject *result = nullptr; @@ -3728,7 +3728,7 @@ static PyObject *CmdIdentify(PyObject * self, PyObject * args) static PyObject *CmdIndex(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int mode; pymol::vla oVLA; @@ -3753,7 +3753,7 @@ static PyObject *CmdIndex(PyObject * self, PyObject * args) static PyObject *CmdFindPairs(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int state1, state2; float cutoff; @@ -3786,14 +3786,14 @@ static PyObject *CmdFindPairs(PyObject * self, PyObject * args) static PyObject *CmdSystem(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int ok = false; int async; ok = PyArg_ParseTuple(args, "Osi", &self, &str1, &async); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -3812,18 +3812,18 @@ static PyObject *CmdSystem(PyObject * self, PyObject * args) static PyObject *CmdGetFeedback(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } if(ok) { if(G->Ready) { - PyObject *result = NULL; + PyObject *result = nullptr; if(G->Terminating) { /* try to bail */ /* BEGIN PROPRIETARY CODE SEGMENT (see disclaimer in "os_proprietary.h") */ @@ -3848,18 +3848,18 @@ static PyObject *CmdGetFeedback(PyObject * self, PyObject * args) static PyObject *CmdGetSeqAlignStr(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; - char *seq = NULL; + char *seq = nullptr; int state; int format; int quiet; - PyObject *result = NULL; + PyObject *result = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "Osiii", &self, &str1, &state, &format, &quiet); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -3876,8 +3876,8 @@ static PyObject *CmdGetSeqAlignStr(PyObject * self, PyObject * args) static PyObject *CmdGetStr(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; pymol::vla vla; char *format; char *sele; @@ -3903,17 +3903,17 @@ static PyObject *CmdGetStr(PyObject * self, PyObject * args) static PyObject *CmdGetModel(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state; char *ref_object; int ref_state; OrthoLineType s1; - PyObject *result = NULL; + PyObject *result = nullptr; int ok = false; API_SETUP_ARGS(G, self, args, "Osisi", &self, &str1, &state, &ref_object, &ref_state); if(!ref_object[0]) - ref_object = NULL; + ref_object = nullptr; APIEnterBlocked(G); ok = (SelectorGetTmp(G, str1, s1) >= 0); if(ok) @@ -3927,8 +3927,8 @@ static PyObject *CmdGetModel(PyObject * self, PyObject * args) static PyObject *CmdGetBonds(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; char *sele; int state; @@ -3943,7 +3943,7 @@ static PyObject *CmdGetBonds(PyObject * self, PyObject * args) static PyObject *CmdCreate(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int target, source, discrete, quiet; int singletons; @@ -3960,7 +3960,7 @@ static PyObject *CmdCreate(PyObject * self, PyObject * args) static PyObject *CmdOrient(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state; float animate; @@ -3974,7 +3974,7 @@ static PyObject *CmdOrient(PyObject * self, PyObject * args) static PyObject *CmdFitPairs(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyObject *list; int quiet = 0; API_SETUP_ARGS(G, self, args, "OOi", &self, &list, &quiet); @@ -3986,7 +3986,7 @@ static PyObject *CmdFitPairs(PyObject * self, PyObject * args) static PyObject *CmdIntraFit(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state; int mode; @@ -4006,7 +4006,7 @@ static PyObject *CmdIntraFit(PyObject * self, PyObject * args) static PyObject *CmdGetAtomCoords(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state; int quiet; @@ -4019,7 +4019,7 @@ static PyObject *CmdGetAtomCoords(PyObject * self, PyObject * args) static PyObject *CmdFit(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int mode; int quiet; @@ -4041,7 +4041,7 @@ static PyObject *CmdFit(PyObject * self, PyObject * args) static PyObject *CmdUpdate(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int int1, int2; int matchmaker, quiet; @@ -4055,7 +4055,7 @@ static PyObject *CmdUpdate(PyObject * self, PyObject * args) static PyObject *CmdDirty(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); API_ASSERT(APIEnterNotModal(G)); OrthoDirty(G); @@ -4065,17 +4065,17 @@ static PyObject *CmdDirty(PyObject * self, PyObject * args) static PyObject *CmdGetObjectList(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; OrthoLineType s1; int ok = false; - PyObject *result = NULL; + PyObject *result = nullptr; ok = PyArg_ParseTuple(args, "Os", &self, &str1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4100,7 +4100,7 @@ static PyObject *CmdGetObjectList(PyObject * self, PyObject * args) static PyObject *CmdGetDistance(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int int1; API_SETUP_ARGS(G, self, args, "Ossi", &self, &str1, &str2, &int1); @@ -4112,7 +4112,7 @@ static PyObject *CmdGetDistance(PyObject * self, PyObject * args) static PyObject *CmdGetAngle(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2, *str3; int int1; API_SETUP_ARGS(G, self, args, "Osssi", &self, &str1, &str2, &str3, &int1); @@ -4124,7 +4124,7 @@ static PyObject *CmdGetAngle(PyObject * self, PyObject * args) static PyObject *CmdGetDihe(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2, *str3, *str4; int int1; API_SETUP_ARGS(G, self, args, "Ossssi", &self, &str1, &str2, &str3, &str4, &int1); @@ -4136,7 +4136,7 @@ static PyObject *CmdGetDihe(PyObject * self, PyObject * args) static PyObject *CmdSetDihe(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2, *str3, *str4; float float1; int int1; @@ -4151,7 +4151,7 @@ static PyObject *CmdSetDihe(PyObject * self, PyObject * args) static PyObject *CmdDo(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int log; int echo; @@ -4163,7 +4163,7 @@ static PyObject *CmdDo(PyObject * self, PyObject * args) if(echo) { OrthoAddOutput(G, "PyMOL>"); OrthoAddOutput(G, str1); - OrthoNewLine(G, NULL, true); + OrthoNewLine(G, nullptr, true); } if((str1[0] == 'P') && (str1[1] == 'y') && (str1[2] == 'M') && (str1[3] == 'O') && (str1[4] == 'L') && (str1[5] == '>')) { @@ -4192,7 +4192,7 @@ static PyObject *CmdDo(PyObject * self, PyObject * args) static PyObject *CmdRock(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1; API_SETUP_ARGS(G, self, args, "Oi", &self, &int1); API_ASSERT(APIEnterNotModal(G)); @@ -4203,13 +4203,13 @@ static PyObject *CmdRock(PyObject * self, PyObject * args) static PyObject *CmdBusyDraw(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1; int ok = false; ok = PyArg_ParseTuple(args, "Oi", &self, &int1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4224,13 +4224,13 @@ static PyObject *CmdBusyDraw(PyObject * self, PyObject * args) static PyObject *CmdSetBusy(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1; int ok = false; ok = PyArg_ParseTuple(args, "Oi", &self, &int1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4244,14 +4244,14 @@ static PyObject *CmdSetBusy(PyObject * self, PyObject * args) static PyObject *CmdGetBusy(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int result = 0; int ok = false; int int1; ok = PyArg_ParseTuple(args, "Oi", &self, &int1); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4265,13 +4265,13 @@ static PyObject *CmdGetBusy(PyObject * self, PyObject * args) static PyObject *CmdGetProgress(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; int reset; /* TO DO */ ok = PyArg_ParseTuple(args, "Oi", &self, &reset); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4315,7 +4315,7 @@ static PyObject *CmdGetProgress(PyObject * self, PyObject * args) static PyObject *CmdGetMoment(PyObject * self, PyObject * args) { /* missing? */ - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; double moment[16]; PyObject *result; char *str1; @@ -4325,7 +4325,7 @@ static PyObject *CmdGetMoment(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Osi", &self, &str1, &state); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4361,12 +4361,12 @@ static PyObject* CmdGetSettingLevel(PyObject*, PyObject* args) static PyObject *CmdGetSettingOfType(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1, int2, int3; char *str1; API_SETUP_ARGS(G, self, args, "Oisii", &self, &int1, &str1, &int2, &int3); APIEnterBlocked(G); - // may set the Python error indicator and return NULL + // may set the Python error indicator and return nullptr auto result = ExecutiveGetSettingOfType(G, int1, str1, int2, int3); APIExitBlocked(G); return result; @@ -4374,7 +4374,7 @@ static PyObject *CmdGetSettingOfType(PyObject * self, PyObject * args) static PyObject *CmdSetFrame(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int mode, frm; API_SETUP_ARGS(G, self, args, "Oii", &self, &mode, &frm); API_ASSERT(APIEnterNotModal(G)); @@ -4385,7 +4385,7 @@ static PyObject *CmdSetFrame(PyObject * self, PyObject * args) static PyObject *CmdFrame(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int frm,trigger; API_SETUP_ARGS(G, self, args, "Oii", &self, &frm, &trigger); API_ASSERT(APIEnterNotModal(G)); @@ -4396,7 +4396,7 @@ static PyObject *CmdFrame(PyObject * self, PyObject * args) static PyObject *CmdStereo(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int i1; API_SETUP_ARGS(G, self, args, "Oi", &self, &i1); API_ASSERT(APIEnterNotModal(G)); @@ -4407,7 +4407,7 @@ static PyObject *CmdStereo(PyObject * self, PyObject * args) static PyObject *CmdReset(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *obj; API_SETUP_ARGS(G, self, args, "Os", &self, &obj); API_ASSERT(APIEnterNotModal(G)); @@ -4419,7 +4419,7 @@ static PyObject *CmdReset(PyObject * self, PyObject * args) #if 0 static PyObject *CmdSetMatrix(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float m[16]; int ok = false; ok = PyArg_ParseTuple(args, "Offffffffffffffff", &self, @@ -4428,7 +4428,7 @@ static PyObject *CmdSetMatrix(PyObject * self, PyObject * args) &m[8], &m[9], &m[10], &m[11], &m[12], &m[13], &m[14], &m[15]); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4442,7 +4442,7 @@ static PyObject *CmdSetMatrix(PyObject * self, PyObject * args) static PyObject *CmdGetMinMax(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float mn[3], mx[3]; char *str1; int state; @@ -4466,14 +4466,14 @@ static PyObject *CmdGetMinMax(PyObject * self, PyObject * args) #if 0 static PyObject *CmdGetMatrix(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float *f; - PyObject *result = NULL; + PyObject *result = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4492,10 +4492,10 @@ static PyObject *CmdGetMatrix(PyObject * self, PyObject * args) static PyObject *CmdGetObjectMatrix(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; char *name; - double *history = NULL; + double *history = nullptr; int ok = false; int found; int state; @@ -4503,7 +4503,7 @@ static PyObject *CmdGetObjectMatrix(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Osi|i", &self, &name, &state, &incl_ttt); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4531,11 +4531,11 @@ static PyObject *CmdGetObjectMatrix(PyObject * self, PyObject * args) static PyObject *CmdGetObjectTTT(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; - PyObject *result = NULL; + PyMOLGlobals *G = nullptr; + PyObject *result = nullptr; const char *name; int state, quiet; - const float *ttt = NULL; + const float *ttt = nullptr; if (!PyArg_ParseTuple(args, "Osii", &self, &name, &state, &quiet)) { API_HANDLE_ERROR; @@ -4557,7 +4557,7 @@ static PyObject *CmdGetObjectTTT(PyObject * self, PyObject * args) static PyObject *CmdMDo(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *cmd; int frame; int append; @@ -4565,7 +4565,7 @@ static PyObject *CmdMDo(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Oisi", &self, &frame, &cmd, &append); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4591,13 +4591,13 @@ static PyObject *CmdMDo(PyObject * self, PyObject * args) static PyObject *CmdMPlay(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int cmd; int ok = false; ok = PyArg_ParseTuple(args, "Oi", &self, &cmd); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4610,13 +4610,13 @@ static PyObject *CmdMPlay(PyObject * self, PyObject * args) static PyObject *CmdMMatrix(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int cmd; int ok = false; ok = PyArg_ParseTuple(args, "Oi", &self, &cmd); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4629,12 +4629,12 @@ static PyObject *CmdMMatrix(PyObject * self, PyObject * args) static PyObject *CmdMClear(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4647,12 +4647,12 @@ static PyObject *CmdMClear(PyObject * self, PyObject * args) static PyObject *CmdRefreshLater(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4665,12 +4665,12 @@ static PyObject *CmdRefreshLater(PyObject * self, PyObject * args) static PyObject *CmdRefresh(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4684,12 +4684,12 @@ static PyObject *CmdRefresh(PyObject * self, PyObject * args) static PyObject *CmdRefreshNow(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; ok = PyArg_ParseTuple(args, "O", &self); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4728,7 +4728,7 @@ static PyObject* CmdPopValidContext(PyObject* self, PyObject* args) static PyObject *CmdPNG(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char* filename = nullptr; int quiet; int result = 0; @@ -4750,7 +4750,7 @@ static PyObject *CmdPNG(PyObject * self, PyObject * args) if(!prior) { if(ray || (!G->HaveGUI && (!SceneGetCopyType(G) || width || height))) { prior = SceneRay(G, width, height, SettingGetGlobal_i(G, cSetting_ray_default_renderer), - NULL, NULL, 0.0F, 0.0F, quiet, NULL, true, -1); + nullptr, nullptr, 0.0F, 0.0F, quiet, nullptr, true, -1); } else if(width || height) { prior = !SceneDeferImage(G, width, height, fileview.c_str(), -1, dpi, format, quiet, nullptr); @@ -4784,7 +4784,7 @@ static PyObject *CmdPNG(PyObject * self, PyObject * args) static PyObject *CmdMPNG(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1, int2, int3, int4, format, mode, quiet; int ok = false; @@ -4794,7 +4794,7 @@ static PyObject *CmdMPNG(PyObject * self, PyObject * args) &width, &height); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4810,7 +4810,7 @@ static PyObject *CmdMPNG(PyObject * self, PyObject * args) static PyObject *CmdMSet(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int start_from,freeze; API_SETUP_ARGS(G, self, args, "Osii", &self, &str1, &start_from,&freeze); @@ -4822,7 +4822,7 @@ static PyObject *CmdMSet(PyObject * self, PyObject * args) static PyObject *CmdMModify(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *object; int action,index,count,target,freeze,quiet; API_SETUP_ARGS(G, self, args, "Oiiiisii", &self, &action, &index, &count, @@ -4835,7 +4835,7 @@ static PyObject *CmdMModify(PyObject * self, PyObject * args) static PyObject *CmdMView(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; int action, first, last, simple, wrap, window, cycles, quiet, state, autogen; float power, bias, linear, hand, scene_cut; @@ -4845,7 +4845,7 @@ static PyObject *CmdMView(PyObject * self, PyObject * args) &window, &cycles, &scene_name, &scene_cut, &quiet, &state, &autogen); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -4860,7 +4860,7 @@ static PyObject *CmdMView(PyObject * self, PyObject * args) static PyObject *CmdViewport(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int w, h; API_SETUP_ARGS(G, self, args, "Oii", &self, &w, &h); API_ASSERT(APIEnterNotModal(G)); @@ -4922,7 +4922,7 @@ static PyObject *CmdViewport(PyObject * self, PyObject * args) static PyObject *CmdFlag(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int flag; int action; @@ -4936,7 +4936,7 @@ static PyObject *CmdFlag(PyObject * self, PyObject * args) static PyObject *CmdColor(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *color; int flags; int quiet; @@ -4950,7 +4950,7 @@ static PyObject *CmdColor(PyObject * self, PyObject * args) static PyObject *CmdColorDef(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char* color; float v[3]; int mode; @@ -4964,7 +4964,7 @@ static PyObject *CmdColorDef(PyObject * self, PyObject * args) static PyObject *CmdDraw(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1, int2; int quiet, antialias; @@ -4988,7 +4988,7 @@ static PyObject *CmdDraw(PyObject * self, PyObject * args) static PyObject *CmdRay(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int w, h, mode; float angle, shift; int quiet; @@ -5007,7 +5007,7 @@ static PyObject *CmdRay(PyObject * self, PyObject * args) static PyObject *CmdClip(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname; float dist; char *str1; @@ -5035,7 +5035,7 @@ static PyObject* CmdGetClip(PyObject* self, PyObject* args) static PyObject *CmdMove(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname; float dist; API_SETUP_ARGS(G, self, args, "Osf", &self, &sname, &dist); @@ -5047,7 +5047,7 @@ static PyObject *CmdMove(PyObject * self, PyObject * args) static PyObject *CmdTurn(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname; float angle; API_SETUP_ARGS(G, self, args, "Osf", &self, &sname, &angle); @@ -5059,7 +5059,7 @@ static PyObject *CmdTurn(PyObject * self, PyObject * args) static PyObject *CmdUnset(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int index; char *str; int state; @@ -5074,7 +5074,7 @@ static PyObject *CmdUnset(PyObject * self, PyObject * args) static PyObject *CmdUnsetBond(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int index; char *str3, *str4; int state; @@ -5099,7 +5099,7 @@ static PyObject *CmdUnsetBond(PyObject * self, PyObject * args) static PyObject *CmdSet(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int index; PyObject *value; char *str; @@ -5116,7 +5116,7 @@ static PyObject *CmdSet(PyObject * self, PyObject * args) static PyObject *CmdSetBond(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int index; PyObject *value; char *str3, *str4; @@ -5144,7 +5144,7 @@ static PyObject *CmdSetBond(PyObject * self, PyObject * args) static PyObject *CmdGetBond(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int index; char *str3, *str4; int state; @@ -5169,7 +5169,7 @@ static PyObject *CmdGetBond(PyObject * self, PyObject * args) static PyObject *CmdDelete(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname; API_SETUP_ARGS(G, self, args, "Os", &self, &sname); API_ASSERT(APIEnterNotModal(G)); @@ -5180,7 +5180,7 @@ static PyObject *CmdDelete(PyObject * self, PyObject * args) static PyObject *CmdCartoon(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname; int type; API_SETUP_ARGS(G, self, args, "Osi", &self, &sname, &type); @@ -5192,7 +5192,7 @@ static PyObject *CmdCartoon(PyObject * self, PyObject * args) static PyObject *CmdShowHide(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char *sname; int rep; int state; @@ -5218,7 +5218,7 @@ static PyObject *CmdShowHide(PyObject * self, PyObject * args) static PyObject *CmdOnOffBySele(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname; int onoff; API_SETUP_ARGS(G, self, args, "Osi", &self, &sname, &onoff); @@ -5230,7 +5230,7 @@ static PyObject *CmdOnOffBySele(PyObject * self, PyObject * args) static PyObject *CmdOnOff(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int state; int parents = 0; @@ -5243,7 +5243,7 @@ static PyObject *CmdOnOff(PyObject * self, PyObject * args) static PyObject *CmdToggle(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname; int rep; API_SETUP_ARGS(G, self, args, "Osi", &self, &sname, &rep); @@ -5255,19 +5255,19 @@ static PyObject *CmdToggle(PyObject * self, PyObject * args) static PyObject *CmdQuit(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int ok = false; int code = EXIT_SUCCESS; ok = PyArg_ParseTuple(args, "O|i", &self, &code); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } if(ok) { if(!APIEnterNotModal(G)) { /* override modal state to enable quit */ - PyMOL_SetModalDraw(G->PyMOL, NULL); + PyMOL_SetModalDraw(G->PyMOL, nullptr); APIEnter(G); } if(!G->Option->no_quit) { @@ -5283,7 +5283,7 @@ static PyObject *CmdQuit(PyObject * self, PyObject * args) static PyObject *CmdFullScreen(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int flag = 0; int ok = false; API_SETUP_ARGS(G, self, args, "Oi", &self, &flag); @@ -5295,7 +5295,7 @@ static PyObject *CmdFullScreen(PyObject * self, PyObject * args) static PyObject *CmdGroup(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *gname, *names; int quiet, action; int ok = false; @@ -5310,7 +5310,7 @@ static PyObject *CmdGroup(PyObject * self, PyObject * args) static PyObject *CmdSelect(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sname, *sele; int quiet; int state = 0; @@ -5331,7 +5331,7 @@ static PyObject *CmdSelect(PyObject * self, PyObject * args) static PyObject *CmdFinishObject(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char* oname; API_SETUP_ARGS(G, self, args, "Os", &self, &oname); @@ -5353,7 +5353,7 @@ static PyObject *CmdFinishObject(PyObject * self, PyObject * args) static PyObject *CmdLoadObject(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *oname; PyObject *model; int frame, type; @@ -5370,11 +5370,11 @@ static PyObject *CmdLoadObject(PyObject * self, PyObject * args) static PyObject *CmdSetStateOrder(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *oname; PyObject *order; - pymol::CObject *obj = NULL; - int *int_array = NULL; + pymol::CObject *obj = nullptr; + int *int_array = nullptr; int ok = false; if(!PyArg_ParseTuple(args, "OsO", &self, &oname, &order)) { @@ -5416,11 +5416,11 @@ static PyObject *CmdSetStateOrder(PyObject * self, PyObject * args) static PyObject *CmdLoadCoords(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state = 0; OrthoLineType s1; - PyObject *coords = NULL; + PyObject *coords = nullptr; API_SETUP_ARGS(G, self, args, "OsO|i", &self, &str1, &coords, &state); pymol::Result<> result; @@ -5448,7 +5448,7 @@ static PyObject *CmdLoadCoords(PyObject * self, PyObject * args) static PyObject *CmdLoadCoordSet(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char* oname; PyObject *model; int frame; @@ -5463,11 +5463,11 @@ static PyObject *CmdLoadCoordSet(PyObject * self, PyObject * args) static PyObject *CmdLoad(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *fname, *oname; - char *object_props = NULL; - char *atom_props = NULL; - char *plugin = NULL; + char *object_props = nullptr; + char *atom_props = nullptr; + char *plugin = nullptr; int frame; cLoadType_t type; int finish, discrete; @@ -5497,13 +5497,13 @@ static PyObject *CmdLoad(PyObject * self, PyObject * args) static PyObject *CmdLoadTraj(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *fname, *oname; int frame, type; int interval, average, start, stop, max, image; char *str1; float shift[3]; - char *plugin = NULL; + char *plugin = nullptr; int quiet = 0; /* TODO */ API_SETUP_ARGS(G, self, args, "Ossiiiiiiisifffs", &self, &oname, &fname, &frame, &type, &interval, &average, &start, &stop, &max, &str1, &image, @@ -5517,7 +5517,7 @@ static PyObject *CmdLoadTraj(PyObject * self, PyObject * args) static PyObject *CmdOrigin(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *obj; float v[3]; int state; @@ -5530,7 +5530,7 @@ static PyObject *CmdOrigin(PyObject * self, PyObject * args) static PyObject *CmdSort(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; API_SETUP_ARGS(G, self, args, "Os", &self, &name); API_ASSERT(APIEnterNotModal(G)); @@ -5544,7 +5544,7 @@ static PyObject *CmdAssignSS(PyObject * self, PyObject * args) /* EXPERIMENTAL */ { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int state, quiet; char *str1, *str2; int preserve; @@ -5561,7 +5561,7 @@ static PyObject *CmdSpheroid(PyObject * self, PyObject * args) /* EXPERIMENTAL */ { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int average; API_SETUP_ARGS(G, self, args, "Osi", &self, &name, &average); @@ -5573,7 +5573,7 @@ static PyObject *CmdSpheroid(PyObject * self, PyObject * args) static PyObject *CmdTest(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; /* regression tests */ int ok = false; @@ -5583,7 +5583,7 @@ static PyObject *CmdTest(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Oii", &self, &group, &code); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -5600,7 +5600,7 @@ static PyObject *CmdTest(PyObject * self, PyObject * args) static PyObject *CmdCenter(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int state; int origin; @@ -5624,7 +5624,7 @@ static PyObject *CmdCenter(PyObject * self, PyObject * args) static PyObject *CmdReference(PyObject * self, PyObject * args) { int ok = false; - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; OrthoLineType s1; int action; char *sele1; @@ -5633,7 +5633,7 @@ static PyObject *CmdReference(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Oisii", &self, &action, &sele1, &state, &quiet); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -5649,7 +5649,7 @@ static PyObject *CmdReference(PyObject * self, PyObject * args) static PyObject *CmdZoom(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; float buffer; int state; @@ -5668,7 +5668,7 @@ static PyObject *CmdZoom(PyObject * self, PyObject * args) static PyObject *CmdIsolevel(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; float level; int state; char *name; @@ -5689,7 +5689,7 @@ static PyObject *CmdIsolevel(PyObject * self, PyObject * args) static PyObject *CmdHAdd(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int quiet; int state; @@ -5703,7 +5703,7 @@ static PyObject *CmdHAdd(PyObject * self, PyObject * args) static PyObject *CmdSetObjectColor(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name, *color; int quiet; API_SETUP_ARGS(G, self, args, "Ossi", &self, &name, &color, &quiet); @@ -5715,7 +5715,7 @@ static PyObject *CmdSetObjectColor(PyObject * self, PyObject * args) static PyObject *CmdGetObjectColorIndex(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; API_SETUP_ARGS(G, self, args, "Os", &self, &str1); APIEnter(G); @@ -5726,7 +5726,7 @@ static PyObject *CmdGetObjectColorIndex(PyObject * self, PyObject * args) static PyObject *CmdRemove(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int quiet; API_SETUP_ARGS(G, self, args, "Osi", &self, &str1, &quiet); @@ -5738,7 +5738,7 @@ static PyObject *CmdRemove(PyObject * self, PyObject * args) static PyObject *CmdRemovePicked(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int i1; int quiet; API_SETUP_ARGS(G, self, args, "Oii", &self, &i1, &quiet); @@ -5750,7 +5750,7 @@ static PyObject *CmdRemovePicked(PyObject * self, PyObject * args) static PyObject *CmdHFill(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int quiet; API_SETUP_ARGS(G, self, args, "Oi", &self, &quiet); API_ASSERT(APIEnterNotModal(G)); @@ -5761,7 +5761,7 @@ static PyObject *CmdHFill(PyObject * self, PyObject * args) static PyObject *CmdHFix(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int quiet; char *str1; API_SETUP_ARGS(G, self, args, "Osi", &self, &str1, &quiet); @@ -5777,7 +5777,7 @@ static PyObject *CmdHFix(PyObject * self, PyObject * args) static PyObject *CmdCycleValence(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int quiet; API_SETUP_ARGS(G, self, args, "Oi", &self, &quiet); API_ASSERT(APIEnterNotModal(G)); @@ -5788,7 +5788,7 @@ static PyObject *CmdCycleValence(PyObject * self, PyObject * args) static PyObject *CmdReplace(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int i1, i2; char *str1, *str2; int quiet; @@ -5801,7 +5801,7 @@ static PyObject *CmdReplace(PyObject * self, PyObject * args) static PyObject *CmdSetGeometry(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int geom, valence; char *sele; API_SETUP_ARGS(G, self, args, "Osii", &self, &sele, &geom, &valence); @@ -5813,7 +5813,7 @@ static PyObject *CmdSetGeometry(PyObject * self, PyObject * args) static PyObject *CmdAttach(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int i1, i2; char *str1; int quiet; @@ -5827,7 +5827,7 @@ static PyObject *CmdAttach(PyObject * self, PyObject * args) static PyObject *CmdFuse(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1, *str2; int mode; int recolor; @@ -5843,7 +5843,7 @@ static PyObject *CmdFuse(PyObject * self, PyObject * args) static PyObject *CmdUnpick(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; API_SETUP_ARGS(G, self, args, "O", &self); API_ASSERT(APIEnterNotModal(G)); EditorInactivate(G); @@ -5853,7 +5853,7 @@ static PyObject *CmdUnpick(PyObject * self, PyObject * args) static PyObject *CmdEdit(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str0, *str1, *str2, *str3; int pkresi, pkbond; int quiet; @@ -5872,7 +5872,7 @@ static PyObject *CmdEdit(PyObject * self, PyObject * args) static PyObject *CmdDrag(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str0; OrthoLineType s0 = ""; int ok = false; @@ -5881,7 +5881,7 @@ static PyObject *CmdDrag(PyObject * self, PyObject * args) ok = PyArg_ParseTuple(args, "Osii", &self, &str0, &quiet,&mode); if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -5898,7 +5898,7 @@ static PyObject *CmdDrag(PyObject * self, PyObject * args) static PyObject *CmdRename(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1, int2; @@ -5911,7 +5911,7 @@ static PyObject *CmdRename(PyObject * self, PyObject * args) static PyObject *CmdOrder(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; int int1, int2; @@ -5924,7 +5924,7 @@ static PyObject *CmdOrder(PyObject * self, PyObject * args) static PyObject *CmdScrollTo(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *name; int i = 0, r = -1; @@ -5948,7 +5948,7 @@ static PyObject *CmdScrollTo(PyObject * self, PyObject * args) static PyObject *CmdWindow(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; int int1, x, y, width, height; API_SETUP_ARGS(G, self, args, "Oiiiii", &self, &int1, &x, &y, &width, &height); API_ASSERT(G->HaveGUI); @@ -5999,7 +5999,7 @@ static PyObject *CmdWindow(PyObject * self, PyObject * args) static PyObject *CmdCEAlign(PyObject *self, PyObject *args) { - PyMOLGlobals * G = NULL; + PyMOLGlobals * G = nullptr; int ok = false; int windowSize = 8, gap_max=30; float d0=3.0, d1=4.0; @@ -6014,7 +6014,7 @@ static PyObject *CmdCEAlign(PyObject *self, PyObject *args) if(ok) { API_SETUP_PYMOL_GLOBALS; - ok = (G != NULL); + ok = (G != nullptr); } else { API_HANDLE_ERROR; } @@ -6023,14 +6023,14 @@ static PyObject *CmdCEAlign(PyObject *self, PyObject *args) lenA = PyList_Size(listA); if (lenA < 1) { - result = NULL; + result = nullptr; ok = false; } if(ok) lenB = PyList_Size(listB); if (ok && lenB < 1) { - result = NULL; + result = nullptr; ok = false; } @@ -6046,7 +6046,7 @@ static PyObject *CmdCEAlign(PyObject *self, PyObject *args) static PyObject *CmdVolume(PyObject *self, PyObject *args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *volume_name, *map_name, *sele; float lvl, fbuf; int state = -1; @@ -6064,7 +6064,7 @@ static PyObject *CmdVolume(PyObject *self, PyObject *args) static PyObject *CmdAssignAtomTypes(PyObject *self, PyObject *args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *sele; int state = -1; int ok = false; @@ -6095,7 +6095,7 @@ static PyObject *CmdSetDiscrete(PyObject * self, PyObject * args) if (!PyArg_ParseTuple(args, "Osi", &self, &name, &discrete)) { API_HANDLE_ERROR; } else { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; API_SETUP_PYMOL_GLOBALS; if (G && APIEnterBlockedNotModal(G)) { @@ -6117,7 +6117,7 @@ static PyObject *CmdSetDiscrete(PyObject * self, PyObject * args) static PyObject *CmdCountDiscrete(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; char *str1; OrthoLineType s1; pymol::vla list; @@ -6145,10 +6145,10 @@ static PyObject *CmdCountDiscrete(PyObject * self, PyObject * args) */ static PyObject *CmdCifGetArray(PyObject * self, PyObject * args) { - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; const char *name, *key, *dtype = ""; ObjectMolecule *obj; - PyObject *ret = NULL; + PyObject *ret = nullptr; ok_assert(1, PyArg_ParseTuple(args, "Oss|s", &self, &name, &key, &dtype)); API_SETUP_PYMOL_GLOBALS; @@ -6524,7 +6524,7 @@ static PyMethodDef Cmd_methods[] = { {"update", CmdUpdate, METH_VARARGS}, {"window", CmdWindow, METH_VARARGS}, {"zoom", CmdZoom, METH_VARARGS}, - {NULL, NULL} /* sentinel */ + {NULL, nullptr} /* sentinel */ }; #ifdef __cplusplus diff --git a/layer4/Menu.cpp b/layer4/Menu.cpp index ce75199c5..51511ec19 100644 --- a/layer4/Menu.cpp +++ b/layer4/Menu.cpp @@ -38,7 +38,7 @@ void MenuActivate(PyMOLGlobals * G, int x, int y, int last_x, int last_y, int pa if(PyErr_Occurred()) PyErr_Print(); if(list) { - PopUpNew(G, x, y, last_x, last_y, passive, list, NULL); + PopUpNew(G, x, y, last_x, last_y, passive, list, nullptr); Py_DECREF(list); } PUnblock(G); @@ -60,7 +60,7 @@ void MenuActivate3fv(PyMOLGlobals * G, int x, int y, int last_x, int last_y, int if(PyErr_Occurred()) PyErr_Print(); if(list) { - PopUpNew(G, x, y, last_x, last_y, passive, list, NULL); + PopUpNew(G, x, y, last_x, last_y, passive, list, nullptr); Py_DECREF(list); } PUnblock(G); @@ -79,7 +79,7 @@ void MenuActivate2Arg(PyMOLGlobals * G, int x, int y, int last_x, int last_y, in if(PyErr_Occurred()) PyErr_Print(); if(list) { - PopUpNew(G, x, y, last_x, last_y, passive, list, NULL); + PopUpNew(G, x, y, last_x, last_y, passive, list, nullptr); Py_DECREF(list); } PUnblock(G); @@ -89,7 +89,7 @@ void MenuActivate2Arg(PyMOLGlobals * G, int x, int y, int last_x, int last_y, in Block *MenuActivate1Arg(PyMOLGlobals * G, int x, int y, int last_x, int last_y, int passive, const char *name, const char *arg1) { - Block *block = NULL; + Block *block = nullptr; #ifndef _PYMOL_NOPY PyObject *list; PBlock(G); @@ -98,7 +98,7 @@ Block *MenuActivate1Arg(PyMOLGlobals * G, int x, int y, int last_x, int last_y, if(PyErr_Occurred()) PyErr_Print(); if(list) { - block = PopUpNew(G, x, y, last_x, last_y, passive, list, NULL); + block = PopUpNew(G, x, y, last_x, last_y, passive, list, nullptr); Py_DECREF(list); } PUnblock(G); @@ -118,7 +118,7 @@ void MenuActivate0Arg(PyMOLGlobals * G, int x, int y, int last_x, int last_y, in if(PyErr_Occurred()) PyErr_Print(); if(list) { - PopUpNew(G, x, y, last_x, last_y, passive, list, NULL); + PopUpNew(G, x, y, last_x, last_y, passive, list, nullptr); Py_DECREF(list); } PUnblock(G); diff --git a/layer4/PopUp.cpp b/layer4/PopUp.cpp index 26870de1d..0792cdab8 100644 --- a/layer4/PopUp.cpp +++ b/layer4/PopUp.cpp @@ -92,7 +92,7 @@ static PyObject * SubGetItem(PyMOLGlobals * G, PyObject ** Sub, const int a) { if(!PyList_Check(elem)) { PBlock(G); - elem = PyObject_CallObject(elem, NULL); + elem = PyObject_CallObject(elem, nullptr); if(PyErr_Occurred()) PyErr_Print(); @@ -107,7 +107,7 @@ static PyObject * SubGetItem(PyMOLGlobals * G, PyObject ** Sub, const int a) { ok_except1: #endif - return NULL; + return nullptr; } /*========================================================================*/ @@ -123,7 +123,7 @@ static Block *PopUpRecursiveFind(Block * block, int x, int y) OrthoGrab(G, block); return block; } - return NULL; + return nullptr; } @@ -132,7 +132,7 @@ Block *PopUpNew(PyMOLGlobals * G, int x, int y, int last_x, int last_y, int passive, PyObject * list, Block * parent) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else /* assumes blocked threads (calls the Python C API) */ @@ -164,11 +164,11 @@ Block *PopUpNew(PyMOLGlobals * G, int x, int y, int last_x, int last_y, } I->Parent = parent; - I->Child = NULL; + I->Child = nullptr; I->NLine = PyList_Size(list); - I->Text = NULL; - I->Command = NULL; - I->Code = NULL; + I->Text = nullptr; + I->Command = nullptr; + I->Code = nullptr; I->Selected = -1; I->StartX = (I->LastX = last_x); I->StartY = (I->LastY = last_y); @@ -361,7 +361,7 @@ static void PopUpForgetChild(Block * block) { CPopUp *I = (CPopUp *) block->reference; - I->Child = NULL; + I->Child = nullptr; } static void PopUpRecursiveDetach(Block * block) @@ -410,7 +410,7 @@ static void PopUpRecursiveFree(Block * block) if(I->Child) PopUpFree(I->Child); - I->Child = NULL; + I->Child = nullptr; if(I->Parent) { PopUpForgetChild(I->Parent); PopUpRecursiveFree(I->Parent); @@ -423,7 +423,7 @@ static void PopUpFreeRecursiveChild(Block * block) CPopUp *I = (CPopUp *) block->reference; if(I->Child) PopUpFreeRecursiveChild(I->Child); - I->Child = NULL; + I->Child = nullptr; PopUpFree(block); } @@ -528,7 +528,7 @@ int CPopUp::drag(int x, int y, int mod) if(I->ChildDelay < UtilGetSeconds(G)) { PopUpDetachRecursiveChild(I->Child); PopUpFreeRecursiveChild(I->Child); - I->Child = NULL; + I->Child = nullptr; I->ChildLine = -1; OrthoDirty(G); OrthoInvalidateDoDraw(G); diff --git a/layer5/PyMOL.cpp b/layer5/PyMOL.cpp index 3cce84afd..d31d58d63 100644 --- a/layer5/PyMOL.cpp +++ b/layer5/PyMOL.cpp @@ -84,7 +84,7 @@ #include #ifndef _PYMOL_NOPY -PyMOLGlobals *SingletonPyMOLGlobals = NULL; +PyMOLGlobals *SingletonPyMOLGlobals = nullptr; #endif #ifdef _PYMOL_LIB_HAS_PYTHON @@ -971,7 +971,7 @@ PyMOLreturn_status PyMOL_CmdSelect(CPyMOL * I, const char *name, const char *sel int ret = -1; PYMOL_API_LOCK - auto res = SelectorCreate(I->G, name, selection, NULL, quiet, NULL); + auto res = SelectorCreate(I->G, name, selection, nullptr, quiet, nullptr); ret = res ? res.result() : -1; PYMOL_API_UNLOCK return return_status_ok(ret >= 0); // if ret is negative it should fail @@ -1449,8 +1449,8 @@ PyMOLreturn_status PyMOL_CmdRampNew(CPyMOL * I, const char *name, const char *ma int ok = true; PyMOLreturn_status result = { PyMOLstatus_FAILURE }; OrthoLineType s1 = ""; - float *color_vla = NULL; - float *range_vla = NULL; + float *color_vla = nullptr; + float *range_vla = nullptr; PYMOL_API_LOCK if(selection && selection[0]) { if(ok) ok = (SelectorGetTmp(I->G, selection, s1) >= 0); @@ -1621,7 +1621,7 @@ static PyMOLreturn_status Loader(CPyMOL * I, const char *content, const char *co content_length, pymol_content_type, object_name, - state - 1, zoom, discrete, finish, multiplex, quiet, NULL, 0, NULL); + state - 1, zoom, discrete, finish, multiplex, quiet, nullptr, 0, nullptr); ok = static_cast(result); } } @@ -1707,7 +1707,7 @@ PyMOLreturn_status PyMOL_CmdPseudoatom(CPyMOL * I, const char *object_name, cons pos[1] = y; pos[2] = z; } else { - pos = NULL; + pos = nullptr; } auto pseudoatom_name = ExecutivePreparePseudoatomName(I->G, object_name); auto res = ExecutivePseudoatom(I->G, pseudoatom_name, selection, name, @@ -1820,7 +1820,7 @@ static const CPyMOLOptions Defaults = { CPyMOLOptions *PyMOLOptions_New(void) { - CPyMOLOptions *result = NULL; + CPyMOLOptions *result = nullptr; result = pymol::calloc(1); if(result) *result = Defaults; @@ -2067,7 +2067,7 @@ void PyMOL_Free(CPyMOL * I) #ifndef _PYMOL_NOPY FreeP(I->G->P_inst); if(I->G == SingletonPyMOLGlobals) - SingletonPyMOLGlobals = NULL; + SingletonPyMOLGlobals = nullptr; #endif FreeP(I->G); @@ -2259,7 +2259,7 @@ void PyMOL_DrawWithoutLock(CPyMOL * I) if (!glDebugMessageCallback) { printf("glDebugMessageCallback not available\n"); } else { - glDebugMessageCallback(gl_debug_proc, NULL); + glDebugMessageCallback(gl_debug_proc, nullptr); glEnable(GL_DEBUG_OUTPUT); } #else @@ -2276,7 +2276,7 @@ void PyMOL_DrawWithoutLock(CPyMOL * I) } { PyMOLModalDrawFn *fn = I->ModalDraw; - I->ModalDraw = NULL; /* always resets to NULL! */ + I->ModalDraw = nullptr; /* always resets to nullptr! */ fn(G); } @@ -2562,7 +2562,7 @@ int PyMOL_GetReshape(CPyMOL * I) PyMOLreturn_int_array PyMOL_GetReshapeInfo(CPyMOL * I, int reset) { - PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, PYMOL_RESHAPE_SIZE, NULL }; + PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, PYMOL_RESHAPE_SIZE, nullptr }; PYMOL_API_LOCK if(reset) I->ReshapeFlag = false; @@ -2616,7 +2616,7 @@ int PyMOL_GetClickReady(CPyMOL * I, int reset) char *PyMOL_GetClickString(CPyMOL * I, int reset) { - char *result = NULL; + char *result = nullptr; PYMOL_API_LOCK int ready = I->ClickReadyFlag; if(reset) I->ClickReadyFlag = false; @@ -2743,7 +2743,7 @@ int PyMOL_GetImageReady(CPyMOL * I, int reset) PyMOLreturn_int_array PyMOL_GetImageInfo(CPyMOL * I) { - PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 2, NULL }; + PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 2, nullptr }; PYMOL_API_LOCK result.array = VLAlloc(int, 2); if(!result.array) { result.status = PyMOLstatus_FAILURE; @@ -2768,7 +2768,7 @@ PyMOLreturn_int_array PyMOL_GetImageDataReturned(CPyMOL * I, int width, int height, int row_bytes, int mode, int reset) { - PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 0, NULL }; + PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 0, nullptr }; int ok = true; int size; void *buffer; @@ -2793,7 +2793,7 @@ PyMOLreturn_int_array PyMOL_GetImageDataReturned(CPyMOL * I, int PyMOL_FreeResultString(CPyMOL * I, char *st) { PYMOL_API_LOCK FreeP(st); - PYMOL_API_UNLOCK return get_status_ok((st != NULL)); + PYMOL_API_UNLOCK return get_status_ok((st != nullptr)); } int PyMOL_GetRedisplay(CPyMOL * I, int reset) @@ -2804,7 +2804,7 @@ int PyMOL_GetRedisplay(CPyMOL * I, int reset) result = I->RedisplayFlag; if(result) { - if(SettingGet_b(G, NULL, NULL, cSetting_defer_updates)) { + if(SettingGet_b(G, nullptr, nullptr, cSetting_defer_updates)) { result = false; } else { if(reset) @@ -2825,7 +2825,7 @@ int PyMOL_GetPassive(CPyMOL * I, int reset) int PyMOL_GetModalDraw(CPyMOL * I) { if(I) - return (I->ModalDraw != NULL); + return (I->ModalDraw != nullptr); return false; } @@ -3061,7 +3061,7 @@ PyMOLreturn_status PyMOL_SetIsEnabledCallback(CPyMOL * I, void *CallbackObject, } PyMOLreturn_int_array PyMOL_GetRepsInSceneForObject(CPyMOL * I, const char *name){ - PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 0, NULL }; + PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 0, nullptr }; int *retarr = 0; PYMOL_API_LOCK retarr = ExecutiveGetRepsInSceneForObject(I->G, name); @@ -3075,7 +3075,7 @@ PyMOLreturn_int_array PyMOL_GetRepsInSceneForObject(CPyMOL * I, const char *name } PyMOLreturn_int_array PyMOL_GetRepsForObject(CPyMOL * I, const char *name){ - PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 0, NULL }; + PyMOLreturn_int_array result = { PyMOLstatus_SUCCESS, 0, nullptr }; int *retarr = 0; PYMOL_API_LOCK retarr = ExecutiveGetRepsForObject(I->G, name); diff --git a/layer5/TestPyMOL.cpp b/layer5/TestPyMOL.cpp index 8a4ec05fa..ff43b14d7 100644 --- a/layer5/TestPyMOL.cpp +++ b/layer5/TestPyMOL.cpp @@ -42,7 +42,7 @@ static int TestPyMOL_00_00(PyMOLGlobals * G) { ObjectMap *obj; ObjectMapDesc _md, *md; - ObjectMapState *ms = NULL; + ObjectMapState *ms = nullptr; int a; @@ -66,14 +66,14 @@ static int TestPyMOL_00_00(PyMOLGlobals * G) ObjectSetName(obj, "00_00"); ExecutiveManageObject(G, obj, -1, false); } - return (obj != NULL); + return (obj != nullptr); } #define STR_MAX 100 static char *get_st(const char array[][STR_MAX]) { - char *result = NULL; + char *result = nullptr; size_t c = 0, l = 0; while(array[c][0]) { l += strlen(array[c]); @@ -301,7 +301,7 @@ int TestPyMOLRun(PyMOLGlobals * G, int group, int test) break; case 2: { - pymol::CObject *obj = NULL; + pymol::CObject *obj = nullptr; float pos[3] = { 0.0, 0.0, 0.0 }; PBlock(G); obj = ObjectCGONewVFontTest(G, "hello", pos); @@ -314,7 +314,7 @@ int TestPyMOLRun(PyMOLGlobals * G, int group, int test) break; case 3: { - pymol::CObject *obj = NULL; + pymol::CObject *obj = nullptr; obj = ObjectGadgetTest(G); if(obj) { ObjectSetName(obj, "gadget"); @@ -419,7 +419,7 @@ int TestPyMOLRun(PyMOLGlobals * G, int group, int test) { char *st = get_st(mol_01_02); ExecutiveLoad(G, nullptr, st, -1, cLoadTypeMOLStr, "test_01_07", 0, -1, 0, 1, 0, 1, - NULL, 0, NULL); + nullptr, 0, nullptr); ExecutiveSetRepVisib(G, "test_01_07", cRepCyl, 1); ExecutiveSetRepVisib(G, "test_01_07", cRepLine, 0); SettingSetGlobal_b(G, cSetting_valence, 1); @@ -434,7 +434,7 @@ int TestPyMOLRun(PyMOLGlobals * G, int group, int test) { char *st = get_st(mol_01_02); ExecutiveLoad(G, nullptr, st, -1, cLoadTypeMOLStr, "test_01_08", 0, -1, 0, 1, 0, 1, - NULL, 0, NULL); + nullptr, 0, nullptr); SettingSetGlobal_b(G, cSetting_valence, 1); ControlRock(G, 1); FreeP(st); @@ -445,7 +445,7 @@ int TestPyMOLRun(PyMOLGlobals * G, int group, int test) { char *st = get_st(mol_01_02); ExecutiveLoad(G, nullptr, st, -1, cLoadTypeMOLStr, "test_01_09", 0, -1, 0, 1, 0, 1, - NULL, 0, NULL); + nullptr, 0, nullptr); ExecutiveSetRepVisib(G, "test_01_09", cRepMesh, 1); ExecutiveSetRepVisib(G, "test_01_09", cRepLine, 0); SettingSetGlobal_b(G, cSetting_valence, 1); diff --git a/layer5/main.cpp b/layer5/main.cpp index 60d268449..3840f1d1a 100644 --- a/layer5/main.cpp +++ b/layer5/main.cpp @@ -70,7 +70,7 @@ static void MainReshape(int width, int height); static void MainDrawLocked(void); static void MainDrag(int x, int y); -static CPyMOL *PyMOLInstance = NULL; /* eliminate */ +static CPyMOL *PyMOLInstance = nullptr; /* eliminate */ struct _CMain { int IdleMode; @@ -1248,7 +1248,7 @@ static void launch(CPyMOLOptions * options, int own_the_options) int multisample_mask = 0; int theWindow = 0; - PyMOLGlobals *G = NULL; + PyMOLGlobals *G = nullptr; PyMOLInstance = PyMOL_NewWithOptions(options); G = PyMOL_GetGlobals(PyMOLInstance); @@ -1489,9 +1489,9 @@ int main_shared(int block_input_hook) PyObject *MainAsPyList(PyMOLGlobals *G) { #ifdef _PYMOL_NOPY - return NULL; + return nullptr; #else - PyObject *result = NULL; + PyObject *result = nullptr; int width, height; result = PyList_New(2); width = SceneGetBlock(G)->getWidth(); @@ -1517,7 +1517,7 @@ int MainFromPyList(PyMOLGlobals *G, PyObject * list) OrthoLineType buffer; if(ok) - ok = (list != NULL); + ok = (list != nullptr); if(ok) ok = PyList_Check(list); if(ok) diff --git a/layerCTest/Test_VLA.cpp b/layerCTest/Test_VLA.cpp index fbf54e475..f509b40b9 100644 --- a/layerCTest/Test_VLA.cpp +++ b/layerCTest/Test_VLA.cpp @@ -54,17 +54,17 @@ TEST_CASE("VLA single non-zero-int Initializer List", "[VLA]") REQUIRE(myVLA[0] == 5); } -TEST_CASE("VLA nullptr Assign", "[VLA]") +TEST_CASE("VLA NULL Assign", "[VLA]") { vla myVLA{1, 2, 3, 4, 5}; - myVLA = nullptr; + myVLA = NULL; REQUIRE(isNullptr(myVLA.data())); } -TEST_CASE("VLA NULL Assign", "[VLA]") +TEST_CASE("VLA nullptr Assign", "[VLA]") { vla myVLA{1, 2, 3, 4, 5}; - myVLA = NULL; + myVLA = nullptr; REQUIRE(isNullptr(myVLA.data())); }