From: <ha...@us...> - 2008-11-14 02:22:14
|
Revision: 10306 http://jmol.svn.sourceforge.net/jmol/?rev=10306&view=rev Author: hansonr Date: 2008-11-14 01:31:02 +0000 (Fri, 14 Nov 2008) Log Message: ----------- 11.7.12 VERSION (2) # new feature: #xxx comments act as targets for goto as well as MESSAGE commands # bug fix: goto xxx with trailing white space fails to find xxx # bug fix: goto with a # comment in the script prior to the target line fails # bug fix: two //xxx comments in a row breaks script # new feature: fully remappable JVXL files # new feature: JVXL file format version 2.0 writing and reading for general vertex/triangle file source. # code: superfast JVXL compression/decompression # bug fix: straightness absolute value -- values 0 (not straight) to 1 (straight) # load =1crn;calculate straightness;color "bwr" range 0 1;color straightness # new feature: efvet file reader (http://ef-site.hgc.jp/eF-site) # isosurface color "rwb" "myfile.efvet" # bug fix: isosurface APBS dx file reader broken (since 4/2007) # menu: "Minimize" GT Modified Paths: -------------- trunk/Jmol/src/org/jmol/viewer/Compiler.java trunk/Jmol/src/org/jmol/viewer/Eval.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/Token.java Modified: trunk/Jmol/src/org/jmol/viewer/Compiler.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Compiler.java 2008-11-13 15:31:03 UTC (rev 10305) +++ trunk/Jmol/src/org/jmol/viewer/Compiler.java 2008-11-14 01:31:02 UTC (rev 10306) @@ -295,7 +295,7 @@ pt1 = script.indexOf("\n", pt) + 1; if (pt1 == 0) pt1 = script.length(); - script = script.substring(0, pt) + script.substring(pt1); + script = script.substring(0, pt--) + script.substring(pt1); } while ((pt = script.indexOf("/**")) >= 0) { pt1 = script.indexOf("**/", pt + 3); @@ -374,7 +374,7 @@ if (lookingAtComment()) { if (nTokens > 0) continue; - comment = script.substring(ichToken, ichToken + cchToken); + comment = script.substring(ichToken, ichToken + cchToken).trim(); int nChar = cchToken; ichCurrentCommand = ichToken; ichToken += cchToken; @@ -386,8 +386,12 @@ } if (comment != null || endOfLine || lookingAtEndOfStatement()) { if (nTokens > 0 || comment != null) { - if (nTokens == 0) + if (nTokens == 0) { ichCurrentCommand = ichToken; + if (comment != null) + addTokenToPrefix(new Token(Token.nada, + (comment.length() == 1 ? comment : comment.substring(1)))); + } iCommand = lltoken.size(); if (thisFunction != null && thisFunction.cmdpt0 < 0) { thisFunction.cmdpt0 = iCommand; @@ -416,9 +420,7 @@ tokCommand = Token.nada; tokenCommand = null; iHaveQuotedString = false; - if (comment != null) { - comment = null; - } + comment = null; } if (ichToken < cchScript) { if (endOfLine) @@ -494,7 +496,7 @@ addTokenToPrefix(new Token(Token.bitset, bs)); continue; } else if (!iHaveQuotedString && lookingAtSpecialString()) { - String str = script.substring(ichToken, ichToken + cchToken).trim(); + String str = script.substring(ichToken, ichToken + cchToken); int pt = str.indexOf(" "); if (pt > 0) { cchToken = pt; @@ -507,7 +509,7 @@ } if (tokCommand == Token.script) { if (!iHaveQuotedString && lookingAtSpecialString()) { - String str = script.substring(ichToken, ichToken + cchToken).trim(); + String str = script.substring(ichToken, ichToken + cchToken); int pt = str.indexOf(" "); if (pt > 0) { cchToken = pt; @@ -528,7 +530,7 @@ if (nTokens == 2 && lastToken.tok == Token.frame) iHaveQuotedString = true; if (nTokens > 2 && !iHaveQuotedString && lookingAtSpecialString()) { - String str = script.substring(ichToken, ichToken + cchToken).trim(); + String str = script.substring(ichToken, ichToken + cchToken); if (str.indexOf(" ") < 0) { addTokenToPrefix(new Token(Token.string, str)); iHaveQuotedString = true; @@ -1200,7 +1202,9 @@ if (ichT > ichToken && script.charAt(ichToken) == '@' && (ichT <= ichToken + 1 || script.charAt(ichToken + 1) != '{')) return false; - cchToken = ichT - ichToken; + while (--ichT > ichToken && Character.isWhitespace(script.charAt(ichT))) { + } + cchToken = ++ichT - ichToken; if (logMessages) Logger.debug("lookingAtSpecialString cchToken=" + cchToken); return cchToken > 0; @@ -1529,7 +1533,7 @@ //compile expressions - isEmbeddedExpression = (tokCommand != Token.function + isEmbeddedExpression = (tokCommand != Token.nada && tokCommand != Token.function && !Token.tokAttrOr(tokCommand, Token.atomExpressionCommand, Token.implicitStringCommand)); boolean checkExpression = isEmbeddedExpression || (Token.tokAttr(tokCommand, Token.atomExpressionCommand)); Modified: trunk/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Eval.java 2008-11-13 15:31:03 UTC (rev 10305) +++ trunk/Jmol/src/org/jmol/viewer/Eval.java 2008-11-14 01:31:02 UTC (rev 10306) @@ -884,6 +884,8 @@ if (token == null) continue; switch (token.tok) { + case Token.nada: + break; case Token.elseif: case Token.ifcmd: case Token.whilecmd: @@ -5721,8 +5723,8 @@ int pcTo = -1; for (int i = 0; i < aatoken.length; i++) { Token[] tokens = aatoken[i]; - if (tokens[0].tok == Token.message) - if (tokens[1].value.toString().equalsIgnoreCase(strTo)) { + if (tokens[0].tok == Token.message || tokens[0].tok == Token.nada) + if (tokens[tokens.length - 1].value.toString().equalsIgnoreCase(strTo)) { pcTo = i; break; } @@ -11647,6 +11649,13 @@ return ""; StringBuffer sb = new StringBuffer(); int tok = statement[0].tok; + switch(tok) { + case Token.nada: + return "#" + statement[0].value; + case Token.end: + if (statement.length == 2 && statement[1].tok == Token.function) + return ((Function)(statement[1].value)).toString(); + } boolean useBraces = true;//(!Token.tokAttr(tok, Token.atomExpressionCommand)); boolean inBrace = false; boolean inClauseDefine = false; Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2008-11-13 15:31:03 UTC (rev 10305) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2008-11-14 01:31:02 UTC (rev 10306) @@ -3,6 +3,10 @@ version=11.7.12 +# new feature: #xxx comments act as targets for goto as well as MESSAGE commands +# bug fix: goto xxx with trailing white space fails to find xxx +# bug fix: goto with a # comment in the script prior to the target line fails +# bug fix: two //xxx comments in a row breaks script # new feature: fully remappable JVXL files # new feature: JVXL file format version 2.0 writing and reading for general vertex/triangle file source. # code: superfast JVXL compression/decompression Modified: trunk/Jmol/src/org/jmol/viewer/Token.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Token.java 2008-11-13 15:31:03 UTC (rev 10305) +++ trunk/Jmol/src/org/jmol/viewer/Token.java 2008-11-14 01:31:02 UTC (rev 10306) @@ -287,7 +287,7 @@ final static int frame = command | 20; final static int frank = command | 21 | setparam | defaultON; final static int geosurface = command | 22 | defaultON; - final static int gotocmd = command | 23; + final static int gotocmd = command | 23 | implicitStringCommand; final static int halo = command | 24 | defaultON; final static int hbond = command | 25 | setparam | expression | defaultON; final static int history = command | 26 | setparam; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |