From: <ha...@us...> - 2014-01-25 04:21:28
|
Revision: 19215 http://sourceforge.net/p/jmol/code/19215 Author: hansonr Date: 2014-01-25 04:21:25 +0000 (Sat, 25 Jan 2014) Log Message: ----------- ___JmolVersion="14.1.8_dev_2014.01.23" bug fix: y = ([3])[1][1] should be [3] not 3 bug fix: break n nonfunctional bug fix: format() and label() functions limited to 4 arguments; should be unlimited bug fix: errors in paths to js code in web export templates. Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/pdb/PdbReader.java trunk/Jmol/src/org/jmol/script/SV.java trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/adapter/readers/pdb/PdbReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/pdb/PdbReader.java 2014-01-25 04:20:35 UTC (rev 19214) +++ trunk/Jmol/src/org/jmol/adapter/readers/pdb/PdbReader.java 2014-01-25 04:21:25 UTC (rev 19215) @@ -850,7 +850,7 @@ private void atom() { - boolean isHetero = line.startsWith("HETATM"); + boolean isHetero = line.startsWith("HETATM"); Atom atom = processAtom(new Atom(), line.substring(12, 16).trim(), line.charAt(16), Modified: trunk/Jmol/src/org/jmol/script/SV.java =================================================================== --- trunk/Jmol/src/org/jmol/script/SV.java 2014-01-25 04:20:35 UTC (rev 19214) +++ trunk/Jmol/src/org/jmol/script/SV.java 2014-01-25 04:21:25 UTC (rev 19215) @@ -812,14 +812,13 @@ String s = null; int i1 = tokenIn.intValue; + boolean isOne = (i2 == Integer.MIN_VALUE); if (i1 == Integer.MAX_VALUE) { // no selections have been made yet -- // we just create a new token with the // same bitset and now indicate either // the selected value or "ALL" (max_value) - if (i2 == Integer.MIN_VALUE) - i2 = i1; - return newSV(tokenIn.tok, i2, tokenIn.value); + return newSV(tokenIn.tok, (isOne ? i1 : i2), tokenIn.value); } int len = 0; boolean isInputSelected = (tokenIn instanceof SV && ((SV) tokenIn).index != Integer.MAX_VALUE); @@ -837,7 +836,7 @@ } break; case varray: - len = ((SV)tokenIn).getList().size(); + len = ((SV) tokenIn).getList().size(); break; case string: s = (String) tokenIn.value; @@ -859,10 +858,10 @@ int row = (i1 - col) / 10; if (col > 0 && col <= len && row <= len) { if (tokenIn.tok == matrix3f) - return newV(decimal, Float.valueOf( - ((M3) tokenIn.value).getElement(row - 1, col - 1))); - return newV(decimal, Float.valueOf( - ((M4) tokenIn.value).getElement(row - 1, col - 1))); + return newV(decimal, Float.valueOf(((M3) tokenIn.value).getElement( + row - 1, col - 1))); + return newV(decimal, + Float.valueOf(((M4) tokenIn.value).getElement(row - 1, col - 1))); } return newV(string, ""); } @@ -880,7 +879,7 @@ else ((M4) tokenIn.value).getRow(i1 - 1, data); } - if (i2 == Integer.MIN_VALUE) + if (isOne) return getVariableAF(data); if (i2 < 1 || i2 > len) return newV(string, ""); @@ -896,15 +895,15 @@ i1 = len + i1; if (i1 < 1) i1 = 1; - if (i2 == 0) - i2 = len; - else if (i2 < 0) - i2 = len + i2; - if (i2 > len) - i2 = len; - else if (i2 < i1) - i2 = i1; + if (!isOne) { + if (i2 == 0) + i2 = len; + else if (i2 < 0) + i2 = len + i2; + if (i2 < i1) + i2 = i1; + } switch (tokenIn.tok) { case bitset: @@ -914,25 +913,31 @@ bs.clearAll(); break; } - int n = 0; - for (int j = bs.nextSetBit(0); j >= 0; j = bs.nextSetBit(j + 1)) - if (++n < i1 || n > i2) - bs.clear(j); + if (isOne) { + isOne = bs.get(i1); + bs.clearAll(); + if (isOne) + bs.set(i1); + } else { + int n = 0; + for (int j = bs.nextSetBit(0); j >= 0; j = bs.nextSetBit(j + 1)) + if (++n < i1 || n > i2) + bs.clear(j); + } break; case string: - if (i1 < 1 || i1 > len) - tokenOut.value = ""; - else - tokenOut.value = s.substring(i1 - 1, i2); + tokenOut.value = (i1 < 1 || i1 > len ? "" + : isOne ? s.substring(i1 - 1, i1) + : s.substring(i1 - 1, Math.min(i2, len))); break; case varray: - if (i1 < 1 || i1 > len || i2 > len) + if (i1 < 1 || i1 > len) return newV(string, ""); - if (i2 == i1) + if (isOne) return ((SV) tokenIn).getList().get(i1 - 1); - List<SV> o2 = new List<SV>(); + List<SV> o2 = new List<SV>(); List<SV> o1 = ((SV) tokenIn).getList(); - n = i2 - i1 + 1; + int n = Math.min(i2, len) - i1 + 1; for (int i = 0; i < n; i++) o2.addLast(newT(o1.get(i + i1 - 1))); tokenOut.value = o2; Modified: trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2014-01-25 04:20:35 UTC (rev 19214) +++ trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2014-01-25 04:21:25 UTC (rev 19215) @@ -6170,26 +6170,34 @@ } private void breakCmd(int pt) { - // pt is a backward reference if (pt < 0) { + // if pt is a backward reference // this is a break within a try{...} block getContextVariableAsVariable("_breakval").intValue = -pt; pcEnd = pc; return; } - pc = Math.abs(aatoken[pt][0].intValue); + // pt is to the FOR, WHILE, or SWITCH statement that is being exited + int ptEnd = Math.abs(aatoken[pt][0].intValue); int tok = aatoken[pt][0].tok; if (tok == T.casecmd || tok == T.defaultcmd) { - theToken = aatoken[pc--][0]; + // breaking from SWITCH + theToken = aatoken[ptEnd--][0]; int ptNext = Math.abs(theToken.intValue); if (theToken.tok != T.end) theToken.intValue = -ptNext; } else { - while (thisContext != null - && !ScriptCompiler.isBreakableContext(thisContext.token.tok)) + // breaking from FOR or WHILE (or PROCESS?) + pc = -1; + while (pc != pt && thisContext != null) { + while (thisContext != null + && !ScriptCompiler.isBreakableContext(thisContext.token.tok)) + popContext(true, false); + pc = thisContext.pc; popContext(true, false); - popContext(true, false); + } } + pc = ptEnd; } static int iProcess; Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2014-01-25 04:20:35 UTC (rev 19214) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2014-01-25 04:21:25 UTC (rev 19215) @@ -15,10 +15,12 @@ ___JmolVersion="14.1.8_dev_2014.01.23" +bug fix: y = ([3])[1][1] should be [3] not 3 +bug fix: break n nonfunctional bug fix: format() and label() functions limited to 4 arguments; should be unlimited - bug fix: errors in paths to js code in web export templates. + JmolVersion="14.1.7" JmolVersion="14.1.7_dev_2014.01.20" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |