Revision: 20785 http://sourceforge.net/p/jmol/code/20785 Author: hansonr Date: 2015-09-22 02:52:54 +0000 (Tue, 22 Sep 2015) Log Message: ----------- Jmol.___JmolVersion="14.3.16_2015.09.21b"
bug fix: for (key in hash){...} fails upon functional iteration (deepCopy) -- code was reusing the FOR variable when it should have been caching it in the context stack Modified Paths: -------------- trunk/Jmol/src/org/jmol/dssx/DSSR1.java trunk/Jmol/src/org/jmol/popup/JmolGenericPopup.java trunk/Jmol/src/org/jmol/script/ContextToken.java trunk/Jmol/src/org/jmol/script/ScriptContext.java trunk/Jmol/src/org/jmol/script/ScriptEval.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/dssx/DSSR1.java =================================================================== --- trunk/Jmol/src/org/jmol/dssx/DSSR1.java 2015-09-21 14:32:59 UTC (rev 20784) +++ trunk/Jmol/src/org/jmol/dssx/DSSR1.java 2015-09-22 02:52:54 UTC (rev 20785) @@ -171,7 +171,7 @@ // smap.put("res_long", removeUnitAtom((String) smap.get("atom1_id")) // + "," + removeUnitAtom((String) smap.get("atom2_id"))); // } -// } +// } if (map.containsKey("counts")) s += "_M.dssr.counts = " + map.get("counts").toString() + "\n"; @@ -360,7 +360,7 @@ } unit2 = (String) map.get("atom2_id"); bs.clearAll(); - a2 = ms.getSequenceBits(unit1, bsAtoms, bs).nextSetBit(0); + a2 = ms.getSequenceBits(unit2, bsAtoms, bs).nextSetBit(0); if (a2 < 0) { Logger.error("Atom " + unit2 + " was not found"); continue; Modified: trunk/Jmol/src/org/jmol/popup/JmolGenericPopup.java =================================================================== --- trunk/Jmol/src/org/jmol/popup/JmolGenericPopup.java 2015-09-21 14:32:59 UTC (rev 20784) +++ trunk/Jmol/src/org/jmol/popup/JmolGenericPopup.java 2015-09-22 02:52:54 UTC (rev 20785) @@ -671,7 +671,8 @@ menuEnable(htMenus.get("PDBnucleicMenu"), (nItems > 0)); @SuppressWarnings("unchecked") Map<String, Object> dssr = (nItems > 0 && modelIndex >= 0 ? (Map<String, Object>) vwr.ms.getInfo(modelIndex, "dssr") : null); - setSecStrucMenu(htMenus.get("aaStructureMenu"), dssr); + if (dssr != null) + setSecStrucMenu(htMenus.get("aaStructureMenu"), dssr); nItems = augmentGroup3List(menu2, "c>", false); menuEnable(menu2, nItems > 0); menuEnable(htMenus.get("PDBcarboMenu"), (nItems > 0)); Modified: trunk/Jmol/src/org/jmol/script/ContextToken.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ContextToken.java 2015-09-21 14:32:59 UTC (rev 20784) +++ trunk/Jmol/src/org/jmol/script/ContextToken.java 2015-09-22 02:52:54 UTC (rev 20785) @@ -28,7 +28,7 @@ class ContextToken extends T { Map<String, SV> contextVariables; - SV[] loopVars; + SV[] forVars; static ContextToken newContext(boolean isOpen) { ContextToken ct = (isOpen ? newCmd(T.push, "{") : newCmd(T.pop, "}")); ct.intValue = 0; Modified: trunk/Jmol/src/org/jmol/script/ScriptContext.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptContext.java 2015-09-21 14:32:59 UTC (rev 20784) +++ trunk/Jmol/src/org/jmol/script/ScriptContext.java 2015-09-22 02:52:54 UTC (rev 20785) @@ -55,6 +55,7 @@ public boolean isJSThread; boolean isStateScript; boolean isTryCatch; + SV[] forVars; int iToken; int lineEnd = Integer.MAX_VALUE; public int[][] lineIndices; Modified: trunk/Jmol/src/org/jmol/script/ScriptEval.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEval.java 2015-09-21 14:32:59 UTC (rev 20784) +++ trunk/Jmol/src/org/jmol/script/ScriptEval.java 2015-09-22 02:52:54 UTC (rev 20785) @@ -3406,7 +3406,7 @@ private boolean cmdFor(int tok, boolean isForCheck) throws ScriptException { ContextToken cmdToken = (ContextToken) theToken; int pt = st[0].intValue; - SV[] loopVars = cmdToken.loopVars; + SV[] forVars = cmdToken.forVars; pt = st[0].intValue; int[] pts = new int[2]; Object bsOrList = null; @@ -3417,15 +3417,15 @@ boolean isMinusMinus = false; int j = 0; String key = null; - if (isForCheck && loopVars != null) { + if (isForCheck && forVars != null) { // for xx IN [...] or for xx FROM [...] tok = T.in; // i in x, already initialized - forVar = loopVars[0]; - forVal = loopVars[1]; - bsOrList = loopVars[1].value; + forVar = forVars[0]; + forVal = forVars[1]; + bsOrList = forVars[1].value; // nth time through j = ++forVal.intValue; if (forVal.tok == T.integer) { @@ -3518,8 +3518,11 @@ break; } } - if (!isForCheck) - pushContext(cmdToken, "FOR"); + if (!isForCheck) { + pushContext(cmdToken, "FOR"); + thisContext.forVars = forVars; + forVars = null; + } if (key == null) { if (isForCheck) { j = (bsOrList == null ? pts[1] + 1 : 2); @@ -3554,10 +3557,10 @@ j = -1; } } - if (loopVars == null) - loopVars = cmdToken.loopVars = new SV[2]; - loopVars[0] = forVar; - loopVars[1] = forVal; + if (forVars == null) + forVars = cmdToken.forVars = new SV[2]; + forVars[0] = forVar; + forVars[1] = forVal; } else { if (T.tokAttr(tokAt(j), T.misc) || (forVal = getContextVariableAsVariable(key)) != null) { @@ -3581,8 +3584,10 @@ } } pt++; - if (!isOK) + if (!isOK) { + cmdToken.forVars = thisContext.forVars; popContext(true, false); + } isForCheck = false; if (!isOK && !chk) pc = Math.abs(pt) - 1; Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-09-21 14:32:59 UTC (rev 20784) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-09-22 02:52:54 UTC (rev 20785) @@ -61,8 +61,13 @@ TODO: ketene messes up orbitals for O; -Jmol.___JmolVersion="14.3.16_2015.09.21" +Jmol.___JmolVersion="14.3.16_2015.09.21b" +bug fix: for (key in hash){...} fails upon functional iteration (deepCopy) + -- code was reusing the FOR variable when it should have been caching it in the context stack + +JmolVersion="14.3.16_2015.09.21" + new feature: Raster3D triangle-only file reader (for DSSR cartoon-block representation) -- see http://skuld.bmsc.washington.edu/raster3d/html/render.html This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits