On Fri, Apr 17, 2015 at 6:44 AM, Rolf Huehne <rhue...@fli-leibniz.de> wrote:
> Hi all,
>
> I have some problems debugging a complex script in Jmol.
>
> First of all, the command 'set scriptReportingLevel' doesn't seem to
> work in Jmol 14.3.13_2015.04.08. It is always setting the value to zero.
>
> Q: What do the numbers (e.g.: $[2.295.299]) in the debugging output
> after the command 'set showScript on' mean?
>
>
$ on first line indicates that this script should read these lines with
$[...] and not others
2 script level
295 line number, without comments
299 command number
The problem with early exit of a function was a misplaced line of code.
This would also have the same effect on other surrounding contexts, such as
if, for, do, and while, so perhaps that was the whole issue.
The previous fix did fix a problem that using an empty array in a for
statement resulted in the loop being run anyway. That's not the case now.
Interesting observation about
x = {"":""}
print x[""]
being the same as
x = {"A":3}
print x[""]
I guess we have to live with that. Jmol doesn't have a "null" variable. The
default for "undefined" is just an empty string.
see http://chemapps.stolaf.edu/jmol/zip/jmol-14.3.13_2015.04.17.zip
Jmol.___JmolVersion="14.3.13_2015.04.16"
bug fix: for in/from broken in 14.3.13_2015.04.05
-- entering a FOR loop with empty has pops {...} context one level too
far, exiting functions
> The first number looks like it could be the function call level.
> The third number could be the line number within the function after
> removing empty lines.
>
> Following the debugging information for a problematic function (~500
> lines of code, see short extract below) the critical line seems to be a
> 'for' loop. Depending on the input data the loop sometimes cycles more
> often (twice instead of once) than indicated by the variable value
> ('fileCount=1' in any of the described cases) or the function is exited
> (without any error message or exception) after reaching the line the
> second time:
>
> $[2.83.82] for (var fileNumber=1; fileNumber<=fileCount; fileNumber++);
> $[2.400.400]
> $[2.83.82] for (var fileNumber=1; fileNumber<=fileCount; fileNumber++);
>
> --- Problematic function, extract ---
> function parseNetworkTsvData(dataHashref) {
> ...
> if (fileCount >0) {
> for (var fileNumber=1; fileNumber<=fileCount; fileNumber++) {
> ...
> }
> ...
> }
> ...
> }
> ---------------------------------------------------------------------
>
> Replacing the old syntax by the new one "for (var fileNumber FROM [1
> fileCount]) {" dosen't change the problematic behaviour. The only
> visible difference can be seen in the case of the additional loop run.
> With the old syntax 'fileNumber' is "1" in the first cycle and "2" in
> the second one. With the new syntax it is "1" during both cycles.
>
> Although I have no clue what difference between the datasets is
> responsible for the different behaviour (they have many differences) it
> seems to be reproducible for each dataset.
>
> Since there might be involved some strange interference between the
> 'for' loop and other block-level elements I have added below also a
> version of the function reduced to all block-level begins/ends.
>
> Regards,
> Rolf
>
> --- Problematic function, larger extract -------------------
> function parseNetworkTsvData(dataHashref) {
> if (dataHashref.type != "hash") {
> } else {
> if (networkType == "") {
> }
> if (dataHashref..subsets.type != "hash") {
> } elseif (dataHashref..subsets.[dataHashref..currentSubsetKey].type
> != "hash") {
> }
> if (dataHashref..networkDefinitions.type != "hash") {
> } else {
> if (dataHashref..networkDefinitions.[networkType].type != "hash") {
> } else {
> if
> (dataHashref..networkDefinitions.[networkType]..nodeColumns.type !=
> "hash") {
> if
> (dataHashref..networkDefinitions.[networkType]..nodeColumns.type !=
> "hash") {
> }
> }
> }
> }
> if (dataHashref..tsvData.type != "array") {
> }
> }
> if (msg != "") {
> }
> if (fileCount >0) {
> if (networkDefs..annotationColumns.type == "hash") {
> }
> if (allNodes..nodeInfo.type != hash) {
> }
> if (allNodes..edgeInfo.type != hash) {
> }
> if (allNodes..edgeKeysUsed.type != hash) {
> }
> if (allNodes..neighbours.type != hash) {
> }
> for (var fileNumber=1; fileNumber<=fileCount; fileNumber++) {
> if (dataHashref..tsvData.[fileNumber].type == "hash") {
> if (tsvData.type == "array") {
> if (rowCount > 0) {
> for (var column in tsvData[1].keys) {
> if (networkType == "generic") {
> if (columnDefs.[column].type != "hash") {
> }
> }
> if (nodeColumns[column]) {
> if (columnDefs[column].type != "hash") {
> } else {
> if (nodeTypesFound[nodeType].type != "hash") {
> }
> if (nodeTypesFound[nodeType]..columnNumbers.type !=
> "array") {
> }
> if (nodeTypesFound[nodeType]..minColumnNumber == "") {
> } else {
> }
> if (nodeTypesFound[nodeType]..maxColumnNumber == "") {
> } else {
> }
> if (columnDefs[column].subTypeInfoKey != "") {
> }
> }
> }
> }
> for (var column in tsvData[1].keys) {
> if (annotationColumns.[column]) {
> if (columnDefs.[column].type != "hash") {
> } else {
> if (targetNodeTypes.type == "array") {
> for (var targetNodeType in targetNodeTypes) {
> if (nodeTypesFound[targetNodeType].type == "hash") {
> if (annotationColumnsFound[column].type !=
> "hash") {
> }
> if (targetColumnCount > 0) {
> if (targetColumnCount == 1) {
> } else {
> if (columnNumber <
> nodeTypesFound[targetNodeType]..minColumnNumber) {
> } elseif (columnNumber >
> nodeTypesFound[targetNodeType]..maxColumnNumber) {
> } else {
> for (var i=1; i<=targetColumnCount; i++) {
> if (targetColumnNumber == 0) {
> } else {
> if (columnNumber >
> currentTargetColumnNumber) {
> } else {
> }
> }
> }
> }
> }
> }
> if
> (annotationColumnsFound[column]..targetNodeTypes.type != "hash") {
> }
> if
> (annotationColumnsFound[column]..targetNodeTypes.[targetNodeType].type
> != "hash") {
> }
> if
> (annotationColumnsFound[column]..minTargetColumnNumber == "") {
> } else {
> }
> if
> (annotationColumnsFound[column]..maxTargetColumnNumber == "") {
> } else {
> }
> }
> }
> if (assignMode != "all") {
> for (var targetNodeType in targetNodeTypesFound) {
> }
> if (columnNumber <
> annotationColumnsFound[column]..minTargetColumnNumber) {
> } elseif (columnNumber >
> annotationColumnsFound[column]..maxTargetColumnNumber) {
> } else {
> for (var currentTargetColumnNumber in
> targetColumnNumbers.sort) {
> if (singleTargetColumnNumber == 0) {
> } else {
> if (columnNumber > currentTargetColumnNumber)
> {
> } else {
> }
> }
> }
> }
> }
> }
> }
> }
> }
> for (var column in annotationColumnsFound.keys) {
> if
> (annotationColumnsFound[column]..singleTargetColumnNumber > 0) {
> } else {
> if
> (annotationColumnsFound[column]..targetNodeTypes.type == "hash") {
> for (targetNodeType in
> annotationColumnsFound[column]..targetNodeTypes) {
> if
> (annotationColumnsFound[column]..targetNodeTypes.[targetNodeType].type
> == "hash") {
> if
>
> (annotationColumnsFound[column]..targetNodeTypes.[targetNodeType]..targetColumnNumber
> > 0) {
> }
> }
> }
> }
> }
> }
> if (msg != "") {
> }
> for (var rowNumber from [1 rowCount]) {
> for (var column in nodeColumnsFound.keys) {
> if (allNodes..nodeInfo.[nodeKey].type != "hash") {
> }
> }
> if (currentNodeKeyCount > 1) {
> for (var i from [1 limit1]) {
> for (var j from [currentNodeKeyCount limit2]) {
> if (i==j) { log "ERROR: i(" + i + ") = j(" + j + ")";
> }
> if (allNodes..edgeKeysUsed.[edgeKey].type != "hash") {
> if (allNodes..edgeKeysUsed.[edgeKeyRev].type !=
> "hash") {
> if (allNodes..neighbours.[nodeKey1].type !=
> "hash") {
> }
> if (allNodes..neighbours.[nodeKey2].type !=
> "hash") {
> }
> } else {
> }
> }
> }
> }
> }
> if (networkType != "generic") {
> for (var column in annotationColumnsFound.keys) {
> if
> (annotationColumnsFound.[column].singleTargetColumnNumber > 0) {
> } else {
> if
> (annotationColumnsFound.[column]..targetColumnNumbers.type == "array") {
> }
> }
> for (var targetColumnNumber in targetColumnNumbers) {
> if (nodeKey != "") {
> }
> }
> }
> }
> }
> }
> } else {
> }
> } else {
> }
> }
> }
> if (allNodes..subnetworkInfo.type == "hash") {
> if (allNodes..subnetworkInfo..nodeKeyToSubnetworkNumber.type ==
> "hash") {
> }
> }
> if (networkDefs..translations.type == "hash") {
> }
> for (var nodeKey in allNodes..nodeInfo) {
> if (allNodes..nodeInfo.[nodeKey]..nodeType != "") {
> }
> if (allNodes..nodeInfo.[nodeKey]..subTypeInfoKey != "") {
> if (allNodes..nodeInfo.[nodeKey].[subTypeInfoKey] != "") {
> }
> }
> if (subnetworkNumbersAvailable) {
> if
> (allNodes..subnetworkInfo..nodeKeyToSubnetworkNumber.[nodeKey].type != "")
> {
> }
> }
> if (translationsAvailable) {
> if (networkDefs..translations..typeToSingleLetter.type == "hash") {
> if (networkDefs..translations..typeToSingleLetter.[nodeType] !=
> "") {
> }
> } else {
> }
> if (networkDefs..translations..typeToTypeId.type == "hash") {
> if (networkDefs..translations..typeToTypeId.[nodeType] != "") {
> }
> if (networkDefs..translations..typeToTypeId.[nodeSubType] != "") {
> }
> } else {
> }
> }
> }
> for (var edgeKey in allNodes..edgeInfo) {
> }
> }
>
> ---------------------------------------------------------------------
>
> --
>
> Rolf Huehne
> Postdoc
>
> Leibniz Institute for Age Research - Fritz Lipmann Institute (FLI)
> Beutenbergstrasse 11
> 07745 Jena, Germany
>
> Phone: +49 3641 65 6205
> Fax: +49 3641 65 6210
> E-Mail: rhue...@fli-leibniz.de
> Website: http://www.fli-leibniz.de
>
> Scientific Director: Prof. Dr. K. Lenhard Rudolph
> Head of Administration: Dr. Daniele Barthel
> Chairman of Board of Trustees: Dennys Klein
>
> VAT No: DE 153 925 464
> Register of Associations: No. 230296, Amtsgericht Jena
> Tax Number: 162/141/08228
>
>
>
> ------------------------------------------------------------------------------
> BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
> Develop your own process in accordance with the BPMN 2 standard
> Learn Process modeling best practices with Bonita BPM through live
> exercises
> http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual-
> event?utm_
> source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
> _______________________________________________
> Jmol-developers mailing list
> Jmol-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>
--
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Department of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr
If nature does not answer first what we want,
it is better to take what answer we get.
-- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers