Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 185107 Details for
Bug 332492
Refactoring [427]: Remove Obsolete Language Features - CQ approved
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Updated Patch File - Addressing Jeff's Review on 12-13-10
RemoveObsoleteLanguageFeatures - Revision 1.txt (text/plain), 167.50 KB, created by
Mark Mozolewski
on 2010-12-14 00:49:13 EST
(
hide
)
Description:
Updated Patch File - Addressing Jeff's Review on 12-13-10
Filename:
MIME Type:
Creator:
Mark Mozolewski
Created:
2010-12-14 00:49:13 EST
Size:
167.50 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.photran.core.vpg >Index: src/org/eclipse/photran/internal/core/refactoring/Messages.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/photran/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/Messages.java,v >retrieving revision 1.15 >diff -u -r1.15 Messages.java >--- src/org/eclipse/photran/internal/core/refactoring/Messages.java 21 Sep 2010 18:32:41 -0000 1.15 >+++ src/org/eclipse/photran/internal/core/refactoring/Messages.java 14 Dec 2010 05:47:37 -0000 >@@ -7,6 +7,11 @@ > * > * Contributors: > * UIUC - Initial API and implementation >+ * Rita Chow - Photran Modifications >+ * Nicola Hall - Photran Modifications >+ * Jerry Hsiao - Photran Modifications >+ * Mark Mozolewski - Photran Modifications >+ * Chamil Wijenayaka - Photran Modifications > *******************************************************************************/ > package org.eclipse.photran.internal.core.refactoring; > >@@ -356,9 +361,37 @@ > > public static String RemoveArithmeticIfRefactoring_Name; > >+ public static String RemoveBranchToEndIfRefactoring_Name; >+ >+ public static String RemoveBranchToEndIfRefactoring_MissingGoToStatement; >+ >+ public static String RemoveBranchToEndIfRefactoring_GoToLabelDoesNotMatchAnyEndIfLabel; >+ >+ public static String RemoveBranchToEndIfRefactoring_BranchToImmediateEndIf; >+ >+ public static String RemoveBranchToEndIfRefactoring_SelectEndIfStatementToRefactor; >+ >+ public static String RemoveBranchToEndIfRefactoring_CanNotFindIfConstruct; >+ >+ public static String RemoveBranchToEndIfRefactoring_CanNotFindGoToStatementForThisLabel; >+ > public static String RemoveComputedGoToRefactoring_Name; > > public static String RemoveComputedGoToRefactoring_PleaseSelectComputedGotoStmt; >+ >+ public static String RemovePauseStmtRefactoring_Name; >+ >+ public static String RemovePauseStmtRefactoring_SelectPauseStmt; >+ >+ public static String RemoveRealAndDoublePrecisionLoopCountersRefactoring_Name; >+ >+ public static String RemoveRealAndDoublePrecisionLoopCountersRefactoring_PleaseSelectADoLoop; >+ >+ public static String RemoveRealAndDoublePrecisionLoopCountersRefactoring_PleaseSelectAControlledDoLoop; >+ >+ public static String RemoveRealAndDoublePrecisionLoopCountersRefactoring_LoopControlVariableMissingDeclaration; >+ >+ public static String RemoveRealAndDoublePrecisionLoopCountersRefactoring_LoopControlVariableNotRealOrDouble; > > public static String RemoveUnusedVariablesRefactoring_CouldNotCompleteOperation; > >Index: src/org/eclipse/photran/internal/core/refactoring/RemoveBranchToEndIfRefactoring.java >=================================================================== >RCS file: src/org/eclipse/photran/internal/core/refactoring/RemoveBranchToEndIfRefactoring.java >diff -N src/org/eclipse/photran/internal/core/refactoring/RemoveBranchToEndIfRefactoring.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/photran/internal/core/refactoring/RemoveBranchToEndIfRefactoring.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,557 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Rita Chow, Nicola Hall, Jerry Hsiao, Mark Mozolewski, Chamil Wijenayaka >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Rita Chow - Initial Implementation >+ * Nicola Hall - Initial Implementation >+ * Jerry Hsiao - Initial Implementation >+ * Mark Mozolewski - Initial Implementation >+ * Chamil Wijenayaka - Initial Implementation >+ *******************************************************************************/ >+package org.eclipse.photran.internal.core.refactoring; >+ >+import java.util.LinkedList; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.OperationCanceledException; >+import org.eclipse.ltk.core.refactoring.RefactoringStatus; >+import org.eclipse.photran.internal.core.analysis.binding.ScopingNode; >+import org.eclipse.photran.internal.core.analysis.loops.ASTProperLoopConstructNode; >+import org.eclipse.photran.internal.core.analysis.loops.ASTVisitorWithLoops; >+import org.eclipse.photran.internal.core.analysis.loops.LoopReplacer; >+import org.eclipse.photran.internal.core.parser.*; >+import org.eclipse.photran.internal.core.refactoring.infrastructure.FortranEditorRefactoring; >+ >+/** >+ * Remove branching to END IF statement from outside its IF ... END IF block. Such branching should >+ * be replaced with branching to CONTINUE statement that immediately follows the END IF statement. >+ * If the END IF statement is followed by a CONTINUE statement then outside GOTO branches should >+ * target the CONTINUE statement. If one does not exist the refactoring will insert one and target >+ * it. GOTOs inside the selected IF block are not re-targeted. >+ * >+ * User Selection Requirements: The labeled END IF that they want considered for the refactoring. >+ * >+ * @author Rita Chow (chow15), Jerry Hsiao (jhsiao2), Mark Mozolewski (mozolews), Chamil Wijenayaka >+ * (wijenay2), Nicola Hall (nfhall2) >+ */ >+public class RemoveBranchToEndIfRefactoring extends FortranEditorRefactoring >+{ >+ private IASTNode selectedNode; >+ >+ private ASTEndIfStmtNode selectedEndIfNode; >+ >+ private ASTIfConstructNode selectedIfConstructNode; >+ >+ private LinkedList<ASTGotoStmtNode> gotoStatements; >+ >+ private LinkedList<ASTGotoStmtNode> selectedGotoStatements; >+ >+ private ASTContinueStmtNode continueAfterIfStmtNode; >+ >+ private LinkedList<ASTGotoStmtNode> selectedGotoStatementWithEndIfLabel; >+ >+ private LinkedList<ASTGotoStmtNode> gotoStatementWithEndIfLabel; >+ >+ /** >+ * Provide GUI refactoring label. >+ */ >+ @Override >+ public String getName() >+ { >+ return Messages.RemoveBranchToEndIfRefactoring_Name; >+ } >+ >+ /** >+ * Preconditions that are checked before the refactoring is applied are: 1) END IF selected must >+ * be labeled and part of an IF block. 2) GOTO from either inside the selected IF block or >+ * outside the selected IF block must target the label of the END IF selected. 3) must be more >+ * GOTOs than just in local selected END IF scope. >+ * >+ */ >+ @Override >+ protected void doCheckInitialConditions(RefactoringStatus status, IProgressMonitor pm) >+ throws PreconditionFailure >+ { >+ ensureProjectHasRefactoringEnabled(status); >+ >+ // Check if selected text is a portion within an END IF statement with label. >+ setSelectedNodeAndEndIfNode(); >+ if ((selectedEndIfNode == null) || (selectedEndIfNode.getLabel() == null)) >+ { >+ fail(Messages.RemoveBranchToEndIfRefactoring_SelectEndIfStatementToRefactor); >+ } >+ >+ // Check if selected END IF is within an IF block. >+ setSelectedIfConstructNode(); >+ if (selectedIfConstructNode == null) >+ { >+ fail(Messages.RemoveBranchToEndIfRefactoring_CanNotFindIfConstruct); >+ } >+ >+ // Check if selected scope contains a branch. >+ setGotoStatements(); >+ if (gotoStatements.isEmpty()) >+ { >+ fail(Messages.RemoveBranchToEndIfRefactoring_MissingGoToStatement); >+ } >+ >+ // Check if contains a GOTO statement with selected END IF label. >+ setGotoStatementsWithEndIfLabel(); >+ if (gotoStatementWithEndIfLabel.size() == 0) >+ { >+ fail(Messages.RemoveBranchToEndIfRefactoring_CanNotFindGoToStatementForThisLabel); >+ } >+ >+ // Check to see if there are branches outside of selected if block to selected END IF label. >+ setSelectedGotoStatementsWithEndIfLabel(); >+ if (selectedGotoStatementWithEndIfLabel.size() == gotoStatementWithEndIfLabel.size()) >+ { >+ fail(Messages.RemoveBranchToEndIfRefactoring_BranchToImmediateEndIf); >+ } >+ >+ setContinueAfterIfStmtNode(); >+ } >+ >+ /** >+ * There are no final conditions. >+ */ >+ @Override >+ protected void doCheckFinalConditions(RefactoringStatus status, IProgressMonitor pm) >+ throws PreconditionFailure >+ { >+ // No final conditions >+ } >+ >+ /** >+ * Separate refactroing methods based on if there is a CONTINUE statement after the selected END >+ * IF (if so target it) or if no CONTINUE statement exists after the END IF block (insert one >+ * with unique label and have GOTO statements outside the IF block target it.). >+ */ >+ @Override >+ protected void doCreateChange(IProgressMonitor pm) throws CoreException, >+ OperationCanceledException >+ { >+ setAstAndNodes(); >+ >+ if (continueAfterIfStmtNode == null) >+ { >+ changeNoContinueAfterEndIf(); // User Story #2 >+ >+ } >+ else >+ { >+ changeGotoLabelToContinueLabel(); // User Story #1 >+ } >+ >+ // User Story 3 checked in doCheckInitialConditions >+ >+ this.addChangeFromModifiedAST(this.fileInEditor, pm); >+ vpg.releaseAST(this.fileInEditor); >+ } >+ >+ /** >+ * Sets AST of selected file and nodes used for refactoring. >+ * >+ * @param None. >+ * >+ * @return None. >+ */ >+ private void setAstAndNodes() >+ { >+ this.astOfFileInEditor = vpg.acquireTransientAST(fileInEditor); >+ >+ // Setup nodes used for refactoring >+ setSelectedNodeAndEndIfNode(); >+ setSelectedIfConstructNode(); >+ setGotoStatements(); >+ setGotoStatementsWithEndIfLabel(); >+ setSelectedGotoStatementsWithEndIfLabel(); >+ setContinueAfterIfStmtNode(); >+ } >+ >+ /** >+ * Set selected node and selected end if node used for refactoring. >+ * >+ * @param None. >+ * >+ * @return None. >+ */ >+ private void setSelectedNodeAndEndIfNode() >+ { >+ selectedNode = findEnclosingNode(this.astOfFileInEditor, this.selectedRegionInEditor); >+ selectedEndIfNode = (ASTEndIfStmtNode)findEnclosingNodeOfType(selectedNode, >+ ASTEndIfStmtNode.class); >+ } >+ >+ /** >+ * Set selected if construct node used for refactoring. >+ * >+ * @param None. >+ * >+ * @return None. >+ */ >+ private void setSelectedIfConstructNode() >+ { >+ selectedIfConstructNode = (ASTIfConstructNode)findEnclosingNodeOfType(selectedEndIfNode, >+ ASTIfConstructNode.class); >+ } >+ >+ /** >+ * Set goto statements used for refactoring. >+ * >+ * @param None. >+ * >+ * @return None. >+ */ >+ private void setGotoStatements() >+ { >+ gotoStatements = getGotoNodes(ScopingNode.getLocalScope(selectedEndIfNode)); >+ } >+ >+ /** >+ * Set go to statements with end if label used for refactoring. >+ * >+ * @param None. >+ * >+ * @return None. >+ */ >+ private void setGotoStatementsWithEndIfLabel() >+ { >+ gotoStatementWithEndIfLabel = findGotoForLabel(gotoStatements, selectedEndIfNode.getLabel() >+ .getText()); >+ } >+ >+ /** >+ * Set selected go to statements with end if label used for refactoring. >+ * >+ * @param None. >+ * >+ * @return None. >+ */ >+ private void setSelectedGotoStatementsWithEndIfLabel() >+ { >+ selectedGotoStatements = getGotoNodes(selectedIfConstructNode); >+ selectedGotoStatementWithEndIfLabel = findGotoForLabel(selectedGotoStatements, >+ selectedEndIfNode.getLabel().getText()); >+ } >+ >+ /** >+ * Set continue after if statement used for refactoring. >+ * >+ * @param None. >+ * >+ * @return None. >+ */ >+ private void setContinueAfterIfStmtNode() >+ { >+ continueAfterIfStmtNode = continueAfterIfStmt(selectedIfConstructNode); >+ } >+ >+ /** >+ * Main refactoring code for condition when CONTINUE statement follows the END..IF that was >+ * selected for refactoring. The logic will renumber/retarget any GOTO statements in the GOTO to >+ * that of the CONINUE label. (Per FORTRAN language standard the CONTINUE statement must have a >+ * label). If any GOTO statement inside the selected END..IF targets the END..IF selected for >+ * the Refactoring then the label of the END..IF will not be removed and that inner GOTO will >+ * still target it. If there are no inner GOTOs targeting the END..IF label then the END..IF >+ * label will be removed as part of the refactoring. >+ * >+ */ >+ private void changeGotoLabelToContinueLabel() >+ { >+ // Check all GOTO statements in the entire PROGRAM to see if they target the END..IF label >+ // number selected during the Refactoring. If so then retarget/renumber them to the >+ // CONTINUE block that follows. (Note: Inner GOTO statements that that target the END..IF >+ // statement are not retargeted/renumbered.) >+ for (ASTGotoStmtNode gotoNode : gotoStatementWithEndIfLabel) >+ { >+ // Do not re-target GOTO statements from within the selected END..IF for refactoring. >+ if (!selectedGotoStatementWithEndIfLabel.contains(gotoNode)) >+ { // Goto targeted to our selected IF..ENDIF block >+ gotoNode.getGotoLblRef().getLabel() >+ .setText(continueAfterIfStmtNode.getLabel().getText()); // Use existing >+ } >+ } >+ >+ // Label of selected END..IF for Refactoring is only removed after all other GOTOs have been >+ // retargeted and if no inner GOTO statements target its label. >+ if (selectedGotoStatementWithEndIfLabel.isEmpty()) >+ { >+ selectedEndIfNode.setLabel(null); >+ selectedEndIfNode.findFirstToken().setWhiteBefore( >+ selectedIfConstructNode.findFirstToken().getWhiteBefore()); // reindenter alt. >+ } >+ >+ } >+ >+ /** >+ * Modify Fortran code to add a CONTINUE statement after labeled END IF then remove END IF label >+ * only if there are no GOTO statements within the selected IF statement that target that END IF >+ * statement. >+ * >+ */ >+ private void changeNoContinueAfterEndIf() >+ { >+ >+ // build the CONTINUE node >+ if (continueAfterIfStmtNode != null) { return; } >+ >+ @SuppressWarnings("unchecked") >+ ASTListNode<ASTNode> listNode = (ASTListNode<ASTNode>)selectedIfConstructNode.getParent(); >+ >+ // build the CONTINUE statement program source code >+ String programString = "program p\n" + selectedEndIfNode.getLabel().getText() + " CONTINUE" //$NON-NLS-1$ //$NON-NLS-2$ >+ + EOL + "end program"; //$NON-NLS-1$ >+ ASTMainProgramNode programNode = (ASTMainProgramNode)parseLiteralProgramUnit(programString); >+ ASTContinueStmtNode continueStmt = (ASTContinueStmtNode)programNode.getBody().get(0); >+ >+ // insert into AST >+ continueStmt.setParent(selectedIfConstructNode.getParent()); >+ listNode.insertAfter(selectedIfConstructNode, continueStmt); >+ >+ // clear label on END IF statement >+ if (selectedGotoStatementWithEndIfLabel.size() == 0) >+ { >+ selectedEndIfNode.setLabel(null); >+ // correct indentation >+ selectedEndIfNode.findFirstToken().setWhiteBefore( >+ selectedIfConstructNode.findFirstToken().getWhiteBefore()); >+ } >+ else >+ { >+ // Grab all labels >+ LinkedList<IActionStmt> actionStmts = getActionStmts(ScopingNode >+ .getLocalScope(selectedEndIfNode)); >+ >+ // Calculate unique label >+ String label = getUniqueLabel(actionStmts); >+ >+ // Set continue label to new label >+ continueStmt.getLabel().setText(label); >+ >+ // Set all goto statements to new label >+ for (ASTGotoStmtNode node : gotoStatementWithEndIfLabel) >+ { >+ if (!selectedGotoStatementWithEndIfLabel.contains(node)) >+ { >+ node.getGotoLblRef().getLabel().setText(label); >+ } >+ } >+ } >+ } >+ >+ /** >+ * Build a list of all GOTO node types from the starting node. >+ * >+ * @param startNode Node to start the search. >+ * >+ * @return LinkedList of GOTO nodes. >+ */ >+ private LinkedList<ASTGotoStmtNode> getGotoNodes(IASTNode startNode) >+ { >+ if (startNode == null) { return null; } >+ >+ /* >+ * Unable to find all goto statements when there are do loops in startNode, so need to >+ * search in the do loops separately. >+ */ >+ final LinkedList<ASTGotoStmtNode> gotoNodes = getGotoStmtsInAllProperLoopConstructs(startNode); >+ >+ startNode.accept(new ASTVisitor() >+ { >+ @Override >+ public void visitASTGotoStmtNode(ASTGotoStmtNode node) >+ { >+ gotoNodes.add(node); >+ } >+ }); >+ >+ return gotoNodes; >+ } >+ >+ /** >+ * Build a list of all proper-loop-construct node types from the starting node. >+ * >+ * @param startNode Node to start the search. >+ * @return LinkedList of proper-loop-construct nodes. >+ */ >+ private LinkedList<ASTGotoStmtNode> getGotoStmtsInAllProperLoopConstructs(IASTNode startNode) >+ { >+ final LinkedList<ASTGotoStmtNode> gotoNodes = new LinkedList<ASTGotoStmtNode>(); >+ final LinkedList<ASTProperLoopConstructNode> loopNodes = getProperLoopConstructs(startNode); >+ >+ for (ASTProperLoopConstructNode loop : loopNodes) >+ { >+ for (IASTNode node : loop.getBody()) >+ { >+ node.accept(new ASTVisitor() >+ { >+ @Override >+ public void visitASTGotoStmtNode(ASTGotoStmtNode node) >+ { >+ gotoNodes.add(node); >+ } >+ }); >+ } >+ } >+ >+ return gotoNodes; >+ } >+ >+ /** >+ * Find GOTO node(s) based on matching label. >+ * >+ * @param gotos List of GOTO statements to check for matching label. >+ * @param label Label to match against. >+ * @return List of GOTO nodes that target the specified label. >+ */ >+ private LinkedList<ASTGotoStmtNode> findGotoForLabel(LinkedList<ASTGotoStmtNode> gotos, >+ String label) >+ { >+ if (gotos == null) { return new LinkedList<ASTGotoStmtNode>(); } >+ >+ LinkedList<ASTGotoStmtNode> gotoWithLabel = new LinkedList<ASTGotoStmtNode>(); >+ for (ASTGotoStmtNode gotoNode : gotos) >+ { >+ if (gotoNode.getGotoLblRef().getLabel().getText().contentEquals(label)) >+ { >+ gotoWithLabel.add(gotoNode); >+ } >+ } >+ >+ return gotoWithLabel; >+ } >+ >+ /** >+ * Check for CONTINUE statement after a if construct node >+ * >+ * @param ifStmt If construct node. >+ * @return continue statement node or null. >+ */ >+ private static ASTContinueStmtNode continueAfterIfStmt(ASTIfConstructNode ifStmt) >+ { >+ if (ifStmt == null) { return null; } >+ >+ @SuppressWarnings("unchecked") >+ ASTListNode<ASTNode> list = (ASTListNode<ASTNode>)ifStmt.getParent(); >+ >+ for (int i = 0; i < list.size() - 1; i++) >+ { >+ if (list.get(i) != null) >+ { >+ if (list.get(i).equals(ifStmt)) >+ { >+ if (list.get(i + 1) instanceof ASTContinueStmtNode) { return (ASTContinueStmtNode)list >+ .get(i + 1); } >+ } >+ } >+ } >+ >+ return null; >+ } >+ >+ /** >+ * Generate a unique label based on the labels passed in (unique in that find the largest and >+ * add 10) >+ * >+ * @param actionStmts List of statements that may be labeled to consider for a unique label. >+ * @return Unique label value. >+ */ >+ private String getUniqueLabel(LinkedList<IActionStmt> actionStmts) >+ { >+ int label = Integer.parseInt(selectedEndIfNode.getLabel().getText()); >+ for (IActionStmt stmt : actionStmts) >+ { >+ if (stmt.getLabel() != null) >+ { >+ int currentLabel = Integer.parseInt(stmt.getLabel().getText()); >+ if (currentLabel > label) >+ { >+ label = currentLabel; >+ } >+ } >+ } >+ label += 10; >+ >+ return String.valueOf(label); >+ } >+ >+ /** >+ * Find Action statement nodes in the tree from the starting search node. >+ * >+ * @param startNode Starting node from which to perform the search. >+ * @return LinkedList of action statement nodes that are found. >+ */ >+ private LinkedList<IActionStmt> getActionStmts(IASTNode startNode) >+ { >+ final LinkedList<IActionStmt> actionStmts = getActionStmtsInAllProperLoopConstructs(); >+ startNode.accept(new ASTVisitor() >+ { >+ @Override >+ public void visitIActionStmt(IActionStmt node) >+ { >+ actionStmts.add(node); >+ } >+ }); >+ >+ return actionStmts; >+ } >+ >+ /** >+ * Find Action statement nodes in entire file in editor. >+ * >+ * @return LinkedList of action statement nodes found. >+ */ >+ private LinkedList<IActionStmt> getActionStmtsInAllProperLoopConstructs() >+ { >+ final LinkedList<IActionStmt> actionStmts = new LinkedList<IActionStmt>(); >+ final LinkedList<ASTProperLoopConstructNode> loopNodes = getProperLoopConstructs(ScopingNode >+ .getLocalScope(selectedEndIfNode)); >+ >+ for (ASTProperLoopConstructNode loop : loopNodes) >+ { >+ for (IASTNode node : loop.getBody()) >+ { >+ node.accept(new ASTVisitor() >+ { >+ @Override >+ public void visitIActionStmt(IActionStmt node) >+ { >+ actionStmts.add(node); >+ } >+ }); >+ } >+ } >+ >+ return actionStmts; >+ } >+ >+ /** >+ * Find all proper loop constructs in the tree from the starting search node. >+ * >+ * @param startNode Starting node from which to perform the search. >+ * @return LinkedList of proper loop construct nodes found. >+ */ >+ private LinkedList<ASTProperLoopConstructNode> getProperLoopConstructs(IASTNode startNode) >+ { >+ final LinkedList<ASTProperLoopConstructNode> loopNodes = new LinkedList<ASTProperLoopConstructNode>(); >+ >+ // Change AST to represent DO-loops as ASTProperLoopConstructNodes >+ LoopReplacer.replaceAllLoopsIn(this.astOfFileInEditor.getRoot()); >+ >+ startNode.accept(new ASTVisitorWithLoops() >+ { >+ @Override >+ public void visitASTProperLoopConstructNode(ASTProperLoopConstructNode node) >+ { >+ loopNodes.add(node); >+ } >+ }); >+ >+ return loopNodes; >+ } >+} >Index: src/org/eclipse/photran/internal/core/refactoring/RemovePauseStmtRefactoring.java >=================================================================== >RCS file: src/org/eclipse/photran/internal/core/refactoring/RemovePauseStmtRefactoring.java >diff -N src/org/eclipse/photran/internal/core/refactoring/RemovePauseStmtRefactoring.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/photran/internal/core/refactoring/RemovePauseStmtRefactoring.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,144 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Rita Chow, Nicola Hall, Jerry Hsiao, Mark Mozolewski, Chamil Wijenayaka >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Rita Chow - Initial Implementation >+ * Nicola Hall - Initial Implementation >+ * Jerry Hsiao - Initial Implementation >+ * Mark Mozolewski - Initial Implementation >+ * Chamil Wijenayaka - Initial Implementation >+ *******************************************************************************/ >+package org.eclipse.photran.internal.core.refactoring; >+ >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.OperationCanceledException; >+import org.eclipse.ltk.core.refactoring.RefactoringStatus; >+import org.eclipse.photran.internal.core.refactoring.infrastructure.FortranEditorRefactoring; >+import org.eclipse.photran.internal.core.parser.*; >+ >+/** >+ * This feature address the replacement of the PAUSE statement with a PRINT and READ statement. >+ * Execution of a PAUSE statement may be different on different platforms. The refactoring assumes >+ * the most basic functionality: it replaces the PAUSE statement with a PRINT statement that >+ * displays the message of the PAUSE statement, immediately followed by a READ statement that waits >+ * for any input from the user. >+ * >+ * User Selection Requirements: The PAUSE statement to be replaced. >+ * >+ * @author Rita Chow (chow15), Jerry Hsiao (jhsiao2), Mark Mozolewski (mozolews), Chamil Wijenayaka >+ * (wijenay2), Nicola Hall (nfhall2) >+ */ >+public class RemovePauseStmtRefactoring extends FortranEditorRefactoring >+{ >+ private IASTNode selectedNode = null; >+ >+ private ASTPauseStmtNode selectedPauseStmt = null; >+ >+ /** >+ * Preconditions checks: Check if project has refactoring is enabled. Checks that the user >+ * selects a PAUSE statement for refactoring. Failure to meet these conditions will result in a >+ * fail-initial condition. >+ */ >+ @Override >+ protected void doCheckInitialConditions(RefactoringStatus status, IProgressMonitor pm) >+ throws org.eclipse.rephraserengine.core.vpg.refactoring.VPGRefactoring.PreconditionFailure >+ { >+ ensureProjectHasRefactoringEnabled(status); >+ >+ // Check if selected is a PAUSE statement >+ setSelectedPauseStmt(); >+ >+ if (selectedPauseStmt == null) >+ { >+ fail(Messages.RemovePauseStmtRefactoring_SelectPauseStmt); >+ } >+ } >+ >+ /** >+ * FinalConditions no final checks required. >+ */ >+ @Override >+ protected void doCheckFinalConditions(RefactoringStatus status, IProgressMonitor pm) >+ throws org.eclipse.rephraserengine.core.vpg.refactoring.VPGRefactoring.PreconditionFailure >+ { >+ } >+ >+ /** >+ * Performs main refactoring (delegated to other methods). >+ */ >+ @Override >+ protected void doCreateChange(IProgressMonitor pm) throws CoreException, >+ OperationCanceledException >+ { >+ changePauseStmt(); >+ >+ // Finalize. >+ this.addChangeFromModifiedAST(this.fileInEditor, pm); >+ vpg.releaseAST(this.fileInEditor); >+ } >+ >+ /** >+ * Provide GUI refactoring label. >+ */ >+ @Override >+ public String getName() >+ { >+ return Messages.RemovePauseStmtRefactoring_Name; >+ } >+ >+ /** >+ * Obtains the selected pause statement else sets the member field to null. >+ */ >+ private void setSelectedPauseStmt() >+ { >+ selectedNode = findEnclosingNode(this.astOfFileInEditor, this.selectedRegionInEditor); >+ >+ selectedPauseStmt = (ASTPauseStmtNode)findEnclosingNodeOfType(selectedNode, >+ ASTPauseStmtNode.class); >+ } >+ >+ /** >+ * Insert modified PRINT statement and build READ() AST node to insert in to the program after >+ * the PRINT statement. >+ */ >+ private void changePauseStmt() >+ { >+ // change to modify the transient AST. >+ this.astOfFileInEditor = vpg.acquireTransientAST(fileInEditor); >+ >+ // check on pause statement performed in initial, should not have changed in final. >+ setSelectedPauseStmt(); >+ >+ String pauseMessage = "\'\'"; //$NON-NLS-1$; >+ >+ // Contents of the PRINT statement to maintain. >+ if (null != selectedPauseStmt.getStringConst()) >+ { >+ pauseMessage = selectedPauseStmt.getStringConst().getText(); >+ } >+ >+ // Build new AST node for modified PRINT statement and new READ statement. >+ String indent = selectedPauseStmt.findFirstToken().getWhiteBefore(); >+ String programString = "program p" + EOL + //$NON-NLS-1$ >+ indent >+ + "PRINT *, " + pauseMessage + selectedPauseStmt.findLastToken().getWhiteBefore() + EOL + //$NON-NLS-1$ >+ indent + "READ (*, *)" + EOL + //$NON-NLS-1$ >+ "end program"; //$NON-NLS-1$ >+ >+ // Insert new AST node in place of selected PRINT statement. >+ ASTMainProgramNode programNode = (ASTMainProgramNode)parseLiteralProgramUnit(programString); >+ ASTPrintStmtNode printStmt = (ASTPrintStmtNode)programNode.getBody().get(0); >+ ASTReadStmtNode readStmt = (ASTReadStmtNode)programNode.getBody().get(1); >+ >+ @SuppressWarnings("unchecked") >+ ASTListNode<ASTNode> listNode = (ASTListNode<ASTNode>)selectedPauseStmt.getParent(); >+ >+ selectedPauseStmt.replaceWith(printStmt); >+ listNode.insertAfter(printStmt, readStmt); >+ } >+} >Index: src/org/eclipse/photran/internal/core/refactoring/RemoveRealAndDoublePrecisionLoopCountersRefactoring.java >=================================================================== >RCS file: src/org/eclipse/photran/internal/core/refactoring/RemoveRealAndDoublePrecisionLoopCountersRefactoring.java >diff -N src/org/eclipse/photran/internal/core/refactoring/RemoveRealAndDoublePrecisionLoopCountersRefactoring.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/photran/internal/core/refactoring/RemoveRealAndDoublePrecisionLoopCountersRefactoring.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,392 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Rita Chow, Nicola Hall, Jerry Hsiao, Mark Mozolewski, Chamil Wijenayaka >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Rita Chow - Initial Implementation >+ * Nicola Hall - Initial Implementation >+ * Jerry Hsiao - Initial Implementation >+ * Mark Mozolewski - Initial Implementation >+ * Chamil Wijenayaka - Initial Implementation >+ *******************************************************************************/ >+package org.eclipse.photran.internal.core.refactoring; >+ >+import java.util.LinkedList; >+import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.core.runtime.OperationCanceledException; >+import org.eclipse.ltk.core.refactoring.RefactoringStatus; >+import org.eclipse.photran.internal.core.analysis.binding.ScopingNode; >+import org.eclipse.photran.internal.core.analysis.loops.LoopReplacer; >+import org.eclipse.photran.internal.core.parser.*; >+import org.eclipse.photran.internal.core.refactoring.infrastructure.FortranEditorRefactoring; >+import org.eclipse.photran.internal.core.analysis.loops.ASTProperLoopConstructNode; >+ >+/** >+ * Remove Real and Double Precision Loop Counter Refactoring: >+ * >+ * This refactoring will take a controlled DO loop, i.e. on that specifies the starting and ending >+ * values for the control loop index and transform it to an uncontrolled do loop where the same loop >+ * index and values are manually inserted into to the loop. If a explicit step size is specified is >+ * used, otherwise an implicit one is inserted. The refactoring checks the start/end values of the >+ * loop control variable to determine if the loop control variable should increment or decrement. >+ * >+ * User Selection Requirements: A controlled DO loop statement to be considered for refactoring. >+ * >+ * @author Rita Chow (chow15), Nicola Hall (nfhall2), Jerry Hsiao (jhsiao2), Mark Mozolewski >+ * (mozolews), Chamil Wijenayaka (wijenay2) >+ */ >+public class RemoveRealAndDoublePrecisionLoopCountersRefactoring extends FortranEditorRefactoring >+{ >+ >+ private IASTNode selectedNode = null; >+ >+ private ASTProperLoopConstructNode selectedDoLoopNode = null; >+ >+ private LinkedList<ASTTypeDeclarationStmtNode> typeDeclarationsInFile; >+ >+ private String doVarName; >+ >+ private boolean shouldReplaceWithDoWhileLoop = false; >+ >+ /** >+ * Provide GUI refactoring label. >+ */ >+ @Override >+ public String getName() >+ { >+ return Messages.RemoveRealAndDoublePrecisionLoopCountersRefactoring_Name; >+ } >+ >+ /** >+ * Set method for DO or DO WHILE refactoring selection variable. >+ * >+ * @param value Set tracking variable for DO or DO WHILE refactoring selection. >+ */ >+ public void setShouldReplaceWithDoWhileLoop(boolean value) >+ { >+ this.shouldReplaceWithDoWhileLoop = value; >+ } >+ >+ /** >+ * Precondition checks: Check if project has refactoring enabled. >+ */ >+ @Override >+ protected void doCheckInitialConditions(RefactoringStatus status, IProgressMonitor pm) >+ throws PreconditionFailure >+ { >+ ensureProjectHasRefactoringEnabled(status); >+ } >+ >+ /** >+ * The following initial conditions are checked (a failure of any will result in a >+ * fail-initial): - A controlled DO loop must be selected by the user. - Loop control variables >+ * of a controlled DO loop must be declared as type REAL or DOUBLE PRECISION only. >+ */ >+ @Override >+ protected void doCheckFinalConditions(RefactoringStatus status, IProgressMonitor pm) >+ throws PreconditionFailure >+ { >+ Boolean doVarNameIsRealOrDouble = false; >+ >+ this.astOfFileInEditor = vpg.acquireTransientAST(fileInEditor); >+ >+ // Change AST to represent DO-loops as ASTProperLoopConstructNodes >+ LoopReplacer.replaceAllLoopsIn(this.astOfFileInEditor.getRoot()); >+ >+ // Identify selected DO loop. >+ selectedNode = findEnclosingNode(this.astOfFileInEditor, this.selectedRegionInEditor); >+ selectedDoLoopNode = (ASTProperLoopConstructNode)findEnclosingNodeOfType(selectedNode, >+ ASTProperLoopConstructNode.class); >+ >+ // Check for invalid selection (DO statement not selected) >+ if (selectedDoLoopNode == null) >+ { >+ fail(Messages.RemoveRealAndDoublePrecisionLoopCountersRefactoring_PleaseSelectADoLoop); >+ } >+ >+ // Check uncontrolled DO loop selected. >+ if (selectedDoLoopNode.getLoopHeader().getLoopControl() == null) >+ { >+ fail(Messages.RemoveRealAndDoublePrecisionLoopCountersRefactoring_PleaseSelectAControlledDoLoop); >+ } >+ >+ // Find all REAL and DOUBLE declared variables. >+ doVarName = selectedDoLoopNode.getLoopHeader().getLoopControl().getVariableName().getText() >+ .toString(); >+ typeDeclarationsInFile = getTypeDeclarations(this.astOfFileInEditor.getRoot()); >+ >+ if (typeDeclarationsInFile == null) >+ { >+ fail(Messages.RemoveRealAndDoublePrecisionLoopCountersRefactoring_LoopControlVariableMissingDeclaration); >+ } >+ >+ // Search all type declarations of the PROGRAM to find DO loop control variable name and >+ // REAL or DOUBLE variable type. >+ for (ASTTypeDeclarationStmtNode typeDeclaration : typeDeclarationsInFile) >+ { >+ >+ if (typeDeclaration.getTypeSpec().isReal() || typeDeclaration.getTypeSpec().isDouble()) >+ { >+ >+ // Search all variable names for this REAL/DOUBLE variable declaration. >+ for (ASTEntityDeclNode entityDeclaration : typeDeclaration.getEntityDeclList()) >+ { >+ >+ if (entityDeclaration.getObjectName().getObjectName().getText() >+ .equals(doVarName)) >+ { >+ doVarNameIsRealOrDouble = true; >+ break; >+ } >+ } >+ >+ } >+ } >+ >+ if (!doVarNameIsRealOrDouble) >+ { >+ fail(Messages.RemoveRealAndDoublePrecisionLoopCountersRefactoring_LoopControlVariableNotRealOrDouble); >+ } >+ } >+ >+ /** >+ * After initial conditions checks pass there is a proper controlled DO loop variable to >+ * refactor. The refactoring consists of building a number of AST node elements and inserting >+ * them in to the program to do the work that the controlled DO loop would have done. This >+ * includes: 1) Initial loop control variable assignment (starting value). 2) >+ * Increment/Decrement control variable by specified amount (implicit or explicit step size) 3) >+ * Check inside DO loop to see if loop variable limit specified is exceeded. >+ */ >+ @Override >+ protected void doCreateChange(IProgressMonitor pm) throws CoreException, >+ OperationCanceledException >+ { >+ String ifCheckLb = selectedDoLoopNode.getLoopHeader().getLoopControl().getLb().toString(); >+ String ifCheckUb = selectedDoLoopNode.getLoopHeader().getLoopControl().getUb().toString(); >+ String ifCheckVar = selectedDoLoopNode.getLoopHeader().getLoopControl().getVariableName() >+ .getText().toString(); >+ >+ // Implicit step size check. >+ String ifCheckStep = null; >+ if (selectedDoLoopNode.getLoopHeader().getLoopControl().getStep() != null) >+ { >+ ifCheckStep = selectedDoLoopNode.getLoopHeader().getLoopControl().getStep().toString(); >+ } >+ else >+ { >+ ifCheckStep = " 1"; //$NON-NLS-1$ >+ } >+ >+ String ifCheckIncrDecr = ""; //$NON-NLS-1$ >+ String ifCheckStr = ""; //$NON-NLS-1$ >+ >+ // Work with both as double type. >+ double dLb = Double.valueOf(ifCheckLb.trim()).doubleValue(); >+ double dUb = Double.valueOf(ifCheckUb.trim()).doubleValue(); >+ >+ // Check for > or < IF check. >+ if (dLb < dUb) >+ { >+ if (shouldReplaceWithDoWhileLoop) >+ ifCheckStr = ifCheckVar + " <=" + ifCheckUb; //$NON-NLS-1$ >+ else >+ ifCheckStr = ifCheckVar + " >" + ifCheckUb; //$NON-NLS-1$ >+ ifCheckIncrDecr = " +"; //$NON-NLS-1$ >+ } >+ else >+ { >+ if (shouldReplaceWithDoWhileLoop) >+ ifCheckStr = ifCheckVar + " >=" + ifCheckUb; //$NON-NLS-1$ >+ else >+ ifCheckStr = ifCheckVar + " <" + ifCheckUb; //$NON-NLS-1$ >+ ifCheckIncrDecr = " -"; //$NON-NLS-1$ >+ } >+ >+ // AST modification for refactoring. >+ if (shouldReplaceWithDoWhileLoop) >+ { >+ insertNewDoWhileLoop(ifCheckLb, ifCheckVar, ifCheckStep, ifCheckIncrDecr, ifCheckStr); >+ } >+ else >+ { >+ insertNewDoLoop(ifCheckLb, ifCheckVar, ifCheckStep, ifCheckIncrDecr, ifCheckStr); >+ } >+ >+ // Finalize >+ this.addChangeFromModifiedAST(this.fileInEditor, pm); >+ vpg.releaseAST(this.fileInEditor); >+ } >+ >+ /** >+ * With provided strings this method builds the new AST nodes for the initial variable >+ * assignment, increment/decrement statement, and IF DO loop break statement. They are then >+ * inserted in to the proper hierarchy of the program AST structure. (See main refactoring >+ * comments at the top of the file for a list of steps performed.) >+ * >+ * @param ifCheckLb Lower bound (starting value) of loop variable. >+ * @param ifCheckVar Loop control variable name. >+ * @param ifCheckStep Loop counter variable step size (implicitly or explicitly declared) >+ * @param ifCheckIncrDecr (+/-) Depending on loop variable count direction. >+ * @param ifCheckStr The IF check condition to break the DO loop. >+ */ >+ private void insertNewDoLoop(String ifCheckLb, String ifCheckVar, String ifCheckStep, >+ String ifCheckIncrDecr, String ifCheckStr) >+ { >+ // Build initial value assignment node. >+ insertInitialCounterAssignment(ifCheckVar, ifCheckLb); >+ >+ // Remove DO control >+ int sizeOfLoopControlString = selectedDoLoopNode.getLoopHeader().getLoopControl() >+ .toString().length(); >+ String replaceLoopControlStringWith = ""; //$NON-NLS-1$ >+ for (int i = 0; i < sizeOfLoopControlString; i++) >+ { >+ replaceLoopControlStringWith += " "; //$NON-NLS-1$ >+ } >+ selectedDoLoopNode.getLoopHeader().setLoopControl(null); >+ selectedDoLoopNode >+ .getLoopHeader() >+ .findLastToken() >+ .setWhiteBefore( >+ replaceLoopControlStringWith >+ + selectedDoLoopNode.getLoopHeader().findLastToken().getWhiteBefore()); >+ >+ // Build increment assignment node. >+ ASTAssignmentStmtNode incrDecrNode = insertCounterAssignment(ifCheckVar, ifCheckIncrDecr, >+ ifCheckStep); >+ >+ // Build IF node for checking DO limits. >+ IExecutionPartConstruct lastNodeInDoLoopBody = selectedDoLoopNode.getBody().get( >+ selectedDoLoopNode.getBody().size() - 1); >+ String initialIndent = ScopingNode.getLocalScope(selectedDoLoopNode).getBody() >+ .findFirstToken().getWhiteBefore(); >+ String programString = ""; //$NON-NLS-1$ >+ programString = "program p\n" + lastNodeInDoLoopBody.findFirstToken().getWhiteBefore() //$NON-NLS-1$ >+ + "IF(" + ifCheckStr + ") THEN\n" //$NON-NLS-1$ //$NON-NLS-2$ >+ + lastNodeInDoLoopBody.findFirstToken().getWhiteBefore() >+ + initialIndent >+ + "EXIT\n" //$NON-NLS-1$ >+ + lastNodeInDoLoopBody.findFirstToken().getWhiteBefore() >+ + "END IF" + EOL + "end program"; //$NON-NLS-1$ //$NON-NLS-2$ >+ ASTMainProgramNode programNode = (ASTMainProgramNode)parseLiteralProgramUnit(programString); >+ ASTIfConstructNode ifNode = (ASTIfConstructNode)programNode.getBody().get(0); >+ >+ // Insert IF node into AST >+ ifNode.setParent(selectedDoLoopNode.getParent()); >+ selectedDoLoopNode.getBody().insertAfter(incrDecrNode, ifNode); >+ } >+ >+ /** >+ * With provided strings this method builds the new AST nodes for the initial variable >+ * assignment, increment/decrement statement, and DO WHILE loop check statement. They are then >+ * inserted in to the proper hierarchy of the program AST structure. (See main refactoring >+ * comments at the top of the file for a list of steps performed.) >+ * >+ * @param ifCheckLb Lower bound (starting value) of loop variable. >+ * @param ifCheckVar Loop control variable name. >+ * @param ifCheckStep Loop counter variable step size (implicitly or explicitly declared) >+ * @param ifCheckIncrDecr (+/-) Depending on loop variable count direction. >+ * @param ifCheckStr The IF check condition to break the DO loop. >+ */ >+ @SuppressWarnings("nls") >+ private void insertNewDoWhileLoop(String ifCheckLb, String ifCheckVar, String ifCheckStep, >+ String ifCheckIncrDecr, String ifCheckStr) >+ { >+ // Build initial value assignment node. >+ insertInitialCounterAssignment(ifCheckVar, ifCheckLb); >+ >+ // Build increment assignment node. >+ insertCounterAssignment(ifCheckVar, ifCheckIncrDecr, ifCheckStep); >+ >+ // Change do loop to while do loop >+ String programString = ""; >+ programString = "program p\n" >+ + selectedDoLoopNode.getLoopHeader().findFirstToken().getWhiteBefore() + "DO WHILE (" >+ + ifCheckStr + ")" >+ + selectedDoLoopNode.getLoopHeader().findLastToken().getWhiteBefore() + EOL >+ + "EXIT\nENDDO" + EOL + "end program"; >+ >+ ASTMainProgramNode programNode = (ASTMainProgramNode)parseLiteralProgramUnit(programString); >+ ASTDoConstructNode doConstructNode = (ASTDoConstructNode)programNode.getBody().get(0); >+ selectedDoLoopNode.setLoopHeader(doConstructNode.getLabelDoStmt()); >+ selectedDoLoopNode.getLoopHeader().findLastToken() >+ .setWhiteBefore(selectedDoLoopNode.getLoopHeader().findLastToken().getWhiteBefore()); >+ } >+ >+ /** >+ * Creates an assignment statement node for the initial loop counter value assignment and >+ * inserts it before the selected DO loop of the refactoring. >+ * >+ * @param ifCheckVar Loop control variable name. >+ * @param ifCheckLb Lower bound (starting value) of loop variable. >+ */ >+ private void insertInitialCounterAssignment(String ifCheckVar, String ifCheckLb) >+ { >+ String programString = "program p\n" + selectedDoLoopNode.findFirstToken().getWhiteBefore() + ifCheckVar + //$NON-NLS-1$ >+ " =" + ifCheckLb + EOL + "end program"; //$NON-NLS-1$ //$NON-NLS-2$ >+ ASTMainProgramNode programNode = (ASTMainProgramNode)parseLiteralProgramUnit(programString); >+ ASTAssignmentStmtNode initValNode = (ASTAssignmentStmtNode)programNode.getBody().get(0); >+ >+ // Insert initial value assignment node into AST >+ initValNode.setParent(selectedDoLoopNode.getParent()); >+ @SuppressWarnings("unchecked") >+ ASTListNode<ASTNode> doNode = (ASTListNode<ASTNode>)selectedDoLoopNode.getParent(); >+ doNode.insertBefore(selectedDoLoopNode, initValNode); >+ } >+ >+ /** >+ * Creates an assignment statement node for the loop counter variable assignment and inserts it >+ * after the selected DO loop of the refactoring. >+ * >+ * @param ifCheckVar Loop control variable name. >+ * @param ifCheckIncrDecr (+/-) Depending on loop variable count direction. >+ * @param ifCheckStep Loop counter variable step size (implicitly or explicitly declared) >+ */ >+ private ASTAssignmentStmtNode insertCounterAssignment(String ifCheckVar, >+ String ifCheckIncrDecr, String ifCheckStep) >+ { >+ IExecutionPartConstruct lastNodeInDoLoopBody = selectedDoLoopNode.getBody().get( >+ selectedDoLoopNode.getBody().size() - 1); >+ String programString = ""; //$NON-NLS-1$ >+ programString = "program p\n" + lastNodeInDoLoopBody.findFirstToken().getWhiteBefore() + ifCheckVar + //$NON-NLS-1$ >+ " = " + ifCheckVar + ifCheckIncrDecr + ifCheckStep + EOL + "end program"; //$NON-NLS-1$ //$NON-NLS-2$ >+ ASTMainProgramNode programNode = (ASTMainProgramNode)parseLiteralProgramUnit(programString); >+ ASTAssignmentStmtNode incrDecrNode = (ASTAssignmentStmtNode)programNode.getBody().get(0); >+ >+ // Insert increment/decrement assignment node into AST >+ incrDecrNode.setParent(selectedDoLoopNode.getParent()); >+ >+ selectedDoLoopNode.getBody().insertAfter(lastNodeInDoLoopBody, incrDecrNode); >+ >+ return incrDecrNode; >+ } >+ >+ /** >+ * Get all variable type declarations in the program. >+ * >+ * @param startNode node to start search. >+ * >+ * @return LinkedList of type declarations nodes. >+ */ >+ private LinkedList<ASTTypeDeclarationStmtNode> getTypeDeclarations(IASTNode startNode) >+ { >+ if (startNode == null) { return null; } >+ >+ final LinkedList<ASTTypeDeclarationStmtNode> typeDeclarations = new LinkedList<ASTTypeDeclarationStmtNode>(); >+ >+ startNode.accept(new ASTVisitor() >+ { >+ @Override >+ public void visitASTTypeDeclarationStmtNode(ASTTypeDeclarationStmtNode node) >+ { >+ typeDeclarations.add(node); >+ } >+ }); >+ >+ return typeDeclarations; >+ } >+} >\ No newline at end of file >Index: src/org/eclipse/photran/internal/core/refactoring/infrastructure/FortranResourceRefactoring.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/photran/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/infrastructure/FortranResourceRefactoring.java,v >retrieving revision 1.11 >diff -u -r1.11 FortranResourceRefactoring.java >--- src/org/eclipse/photran/internal/core/refactoring/infrastructure/FortranResourceRefactoring.java 21 Sep 2010 15:08:23 -0000 1.11 >+++ src/org/eclipse/photran/internal/core/refactoring/infrastructure/FortranResourceRefactoring.java 14 Dec 2010 05:47:38 -0000 >@@ -7,6 +7,11 @@ > * > * Contributors: > * UIUC - Initial API and implementation >+ * Rita Chow - Photran Modifications >+ * Nicola Hall - Photran Modifications >+ * Jerry Hsiao - Photran Modifications >+ * Mark Mozolewski - Photran Modifications >+ * Chamil Wijenayaka - Photran Modifications > *******************************************************************************/ > package org.eclipse.photran.internal.core.refactoring.infrastructure; > >@@ -373,6 +378,27 @@ > return null; > } > >+ /** >+ * Get node based on type. >+ * >+ * @param startNode node to start search. >+ * @param typeChecker instance type to search. >+ * >+ * @return node if found else null. >+ */ >+ protected IASTNode findEnclosingNodeOfType(IASTNode startNode, Class classType) >+ { >+ if(startNode == null) { return null; } >+ >+ IASTNode node = startNode; >+ while ((node != null) && (node.getClass() != classType)) >+ { >+ node = node.getParent(); >+ } >+ >+ return node; >+ } >+ > protected static boolean nodeExactlyEnclosesRegion(IASTNode parent, Token firstToken, Token lastToken) > { > return parent.findFirstToken() == firstToken && parent.findLastToken() == lastToken; >#P org.eclipse.photran.core.vpg.tests >Index: refactoring-test-code/remove-branch-to-end-if/branch_from_Inside_and_outside_if_block/branch_from_Inside_and_outside_if_block.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/branch_from_Inside_and_outside_if_block/branch_from_Inside_and_outside_if_block.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/branch_from_Inside_and_outside_if_block/branch_from_Inside_and_outside_if_block.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/branch_from_Inside_and_outside_if_block/branch_from_Inside_and_outside_if_block.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,29 @@ >+! More complicated PROGRAM to check that outer GOTOs >+! are retargetted to existing CONTINUE statement >+! but END IF label is not removed since inner GOTO >+! targets it. >+ >+PROGRAM branch_from_inside_and_outside_if_block >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ GOTO 30 >+ ELSE >+ sum = sum + sum >+ GOTO 50 >+30 END IF >+40 CONTINUE >+10 END IF >+20 CONTINUE >+ PRINT *, 'sum:', sum >+ IF (sum.ge.100) THEN >+ PRINT *, 'sum:', sum >+ ELSE >+ sum = sum + sum >+ GOTO 50 >+50 END IF !<<<<< 27, 1, 27, 9, pass >+60 CONTINUE >+END PROGRAM branch_from_inside_and_outside_if_block >Index: refactoring-test-code/remove-branch-to-end-if/branch_from_Inside_and_outside_if_block/branch_from_Inside_and_outside_if_block.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/branch_from_Inside_and_outside_if_block/branch_from_Inside_and_outside_if_block.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/branch_from_Inside_and_outside_if_block/branch_from_Inside_and_outside_if_block.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/branch_from_Inside_and_outside_if_block/branch_from_Inside_and_outside_if_block.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,29 @@ >+! More complicated PROGRAM to check that outer GOTOs >+! are retargetted to existing CONTINUE statement >+! but END IF label is not removed since inner GOTO >+! targets it. >+ >+PROGRAM branch_from_inside_and_outside_if_block >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ GOTO 30 >+ ELSE >+ sum = sum + sum >+ GOTO 60 >+30 END IF >+40 CONTINUE >+10 END IF >+20 CONTINUE >+ PRINT *, 'sum:', sum >+ IF (sum.ge.100) THEN >+ PRINT *, 'sum:', sum >+ ELSE >+ sum = sum + sum >+ GOTO 50 >+50 END IF !<<<<< 27, 1, 27, 9, pass >+60 CONTINUE >+END PROGRAM branch_from_inside_and_outside_if_block >Index: refactoring-test-code/remove-branch-to-end-if/branch_from_inside_and_outside_if_block_no_do_loop/branch_from_inside_and_outside_if_block_no_do_loop.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/branch_from_inside_and_outside_if_block_no_do_loop/branch_from_inside_and_outside_if_block_no_do_loop.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/branch_from_inside_and_outside_if_block_no_do_loop/branch_from_inside_and_outside_if_block_no_do_loop.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/branch_from_inside_and_outside_if_block_no_do_loop/branch_from_inside_and_outside_if_block_no_do_loop.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,26 @@ >+! More complicated PROGRAM to check that outer GOTOs >+! are retargetted a CONTINUE statement that is inserted >+! but END IF label is not removed since inner GOTO >+! targets it. >+ >+PROGRAM branch_from_inside_and_outside_if_block_no_do_loop >+ INTEGER :: sum, i >+ sum = 0 >+ IF (MOD(i,2).eq.0) THEN >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ GOTO 30 >+ ELSE >+ sum = sum + sum >+ GOTO 50 >+30 END IF >+10 END IF >+ >+ PRINT *, 'sum:', sum >+ IF (sum.ge.100) THEN >+ PRINT *, 'sum:', sum >+ ELSE >+ sum = sum + sum >+ GOTO 50 >+50 END IF !<<<<< 25, 1, 25, 9, pass >+END PROGRAM branch_from_inside_and_outside_if_block_no_do_loop >Index: refactoring-test-code/remove-branch-to-end-if/branch_from_inside_and_outside_if_block_no_do_loop/branch_from_inside_and_outside_if_block_no_do_loop.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/branch_from_inside_and_outside_if_block_no_do_loop/branch_from_inside_and_outside_if_block_no_do_loop.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/branch_from_inside_and_outside_if_block_no_do_loop/branch_from_inside_and_outside_if_block_no_do_loop.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/branch_from_inside_and_outside_if_block_no_do_loop/branch_from_inside_and_outside_if_block_no_do_loop.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+! More complicated PROGRAM to check that outer GOTOs >+! are retargetted a CONTINUE statement that is inserted >+! but END IF label is not removed since inner GOTO >+! targets it. >+ >+PROGRAM branch_from_inside_and_outside_if_block_no_do_loop >+ INTEGER :: sum, i >+ sum = 0 >+ IF (MOD(i,2).eq.0) THEN >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ GOTO 30 >+ ELSE >+ sum = sum + sum >+ GOTO 60 >+30 END IF >+10 END IF >+ >+ PRINT *, 'sum:', sum >+ IF (sum.ge.100) THEN >+ PRINT *, 'sum:', sum >+ ELSE >+ sum = sum + sum >+ GOTO 50 >+50 END IF !<<<<< 25, 1, 25, 9, pass >+60 CONTINUE >+END PROGRAM branch_from_inside_and_outside_if_block_no_do_loop >Index: refactoring-test-code/remove-branch-to-end-if/branch_to_immediate_end_if_from_else/branch_to_immediate_end_if_from_else.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/branch_to_immediate_end_if_from_else/branch_to_immediate_end_if_from_else.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/branch_to_immediate_end_if_from_else/branch_to_immediate_end_if_from_else.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/branch_to_immediate_end_if_from_else/branch_to_immediate_end_if_from_else.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+! END IF selected that only has its own GOTO targetting >+! it so no refactoring is performed by design and >+! user it told so. >+ >+PROGRAM branch_to_immediate_end_if_from_else >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ GOTO 10 >+ ELSE >+ sum = sum + sum >+ GOTO 30 >+30 END IF !<<<<< 16, 1, 16, 9, fail-initial >+40 CONTINUE >+10 END IF >+20 CONTINUE >+ PRINT *, 'sum:', sum >+END PROGRAM branch_to_immediate_end_if_from_else >Index: refactoring-test-code/remove-branch-to-end-if/branch_to_immediate_end_if_from_else/branch_to_immediate_end_if_from_else.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/branch_to_immediate_end_if_from_else/branch_to_immediate_end_if_from_else.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/branch_to_immediate_end_if_from_else/branch_to_immediate_end_if_from_else.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/branch_to_immediate_end_if_from_else/branch_to_immediate_end_if_from_else.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,22 @@ >+! More complicated PROGRAM to check that outer GOTOs >+! are retargeted a CONTINUE statement that is inserted >+! but END IF label is not removed since inner GOTO >+! targets it. >+ >+PROGRAM branch_to_immediate_end_if_from_else >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ GOTO 10 >+ ELSE >+ sum = sum + sum >+ GOTO 30 >+30 END IF !<<<<< 16, 1, 16, 9, fail-initial >+40 CONTINUE >+10 END IF >+20 CONTINUE >+ PRINT *, 'sum:', sum >+END PROGRAM branch_to_immediate_end_if_from_else >Index: refactoring-test-code/remove-branch-to-end-if/nested_If_block_branch_from_else/nested_If_block_branch_from_else.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/nested_If_block_branch_from_else/nested_If_block_branch_from_else.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/nested_If_block_branch_from_else/nested_If_block_branch_from_else.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/nested_If_block_branch_from_else/nested_If_block_branch_from_else.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,22 @@ >+! With a DO statement enclosing nested IF blocks make sure >+! existing CONTINUE statement is targeted for outer GOTOs >+! and since no inner GOTO exists remove the label of >+! selected END IF (check reindentation as well). >+ >+PROGRAM nested_if_block_branch_from_else >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ GOTO 30 >+ ELSE >+ sum = sum + sum >+ GOTO 10 >+30 END IF >+40 CONTINUE >+10 END IF !<<<<< 19, 1, 19, 9, fail-initial >+20 CONTINUE >+ PRINT *, 'sum:', sum >+END PROGRAM nested_if_block_branch_from_else >Index: refactoring-test-code/remove-branch-to-end-if/nested_If_block_branch_from_else/nested_If_block_branch_from_else.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/nested_If_block_branch_from_else/nested_If_block_branch_from_else.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/nested_If_block_branch_from_else/nested_If_block_branch_from_else.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/nested_If_block_branch_from_else/nested_If_block_branch_from_else.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,22 @@ >+! With a DO statement enclosing nested IF blocks make sure >+! existing CONTINUE statement is targeted for outer GOTOs >+! and since no inner GOTO exists remove the label of >+! selected END IF (check reindentation as well). >+ >+PROGRAM nested_if_block_branch_from_else >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ GOTO 30 >+ ELSE >+ sum = sum + sum >+ GOTO 20 >+30 END IF >+40 CONTINUE >+ END IF !<<<<< 19, 1, 19, 9, fail-initial >+20 CONTINUE >+ PRINT *, 'sum:', sum >+END PROGRAM nested_if_block_branch_from_else >Index: refactoring-test-code/remove-branch-to-end-if/nested_if_block_basic/nested_if_block_basic.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/nested_if_block_basic/nested_if_block_basic.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/nested_if_block_basic/nested_if_block_basic.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/nested_if_block_basic/nested_if_block_basic.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+! Using a nested IF block check that GOTO of inner IF >+! block is still considered an outer GOTO statement >+! so a CONTINUE statement is inserted and that GOTO >+! (and other outer GOTOs) target the new CONTINUE statement >+ >+PROGRAM NestedIfBlockBasic >+ INTEGER :: k, i >+ READ(*,*) k >+ IF (k.lt.10) THEN >+ GOTO 20 >+ END IF >+ i = k - 10 >+ IF (i.gt.100) THEN >+ i = i - 100 >+ IF (i.lt.10) THEN >+ GOTO 20 >+ END IF >+ i = i - 10 >+20 END IF !<<<<< 19, 1, 19, 10, pass >+ PRINT *, i >+END PROGRAM NestedIfBlockBasic >Index: refactoring-test-code/remove-branch-to-end-if/nested_if_block_basic/nested_if_block_basic.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/nested_if_block_basic/nested_if_block_basic.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/nested_if_block_basic/nested_if_block_basic.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/nested_if_block_basic/nested_if_block_basic.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,22 @@ >+! Using a nested IF block check that GOTO of inner IF >+! block is still considered an outer GOTO statement >+! so a CONTINUE statement is inserted and that GOTO >+! (and other outer GOTOs) target the new CONTINUE statement >+ >+PROGRAM NestedIfBlockBasic >+ INTEGER :: k, i >+ READ(*,*) k >+ IF (k.lt.10) THEN >+ GOTO 30 >+ END IF >+ i = k - 10 >+ IF (i.gt.100) THEN >+ i = i - 100 >+ IF (i.lt.10) THEN >+ GOTO 20 >+ END IF >+ i = i - 10 >+20 END IF !<<<<< 19, 1, 19, 10, pass >+30 CONTINUE >+ PRINT *, i >+END PROGRAM NestedIfBlockBasic >Index: refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_inner_end_if/nested_if_block_branch_to_immediate_inner_end_if.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_inner_end_if/nested_if_block_branch_to_immediate_inner_end_if.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_inner_end_if/nested_if_block_branch_to_immediate_inner_end_if.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_inner_end_if/nested_if_block_branch_to_immediate_inner_end_if.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+! Only GOTO targets the selected END IF for refactoring >+! but since a refactoring would not make any changes >+! by design we fail and warn the user that no change >+! would occur. >+ >+PROGRAM nested_if_block_branch_to_immediate_inner_end_if >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ GOTO 30 >+ ELSE >+ sum = sum + sum >+30 END IF !<<<<< 16, 1, 16, 9, fail-initial >+40 CONTINUE >+10 END IF >+20 CONTINUE >+ PRINT *, 'sum:', sum >+END PROGRAM nested_if_block_branch_to_immediate_inner_end_if >Index: refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_inner_end_if/nested_if_block_branch_to_immediate_inner_end_if.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_inner_end_if/nested_if_block_branch_to_immediate_inner_end_if.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_inner_end_if/nested_if_block_branch_to_immediate_inner_end_if.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_inner_end_if/nested_if_block_branch_to_immediate_inner_end_if.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+! Only GOTO targets the selected END IF for refactoring >+! but since a refactoring would not make any changes >+! by design we fail and warn the user that no change >+! would occur. >+ >+PROGRAM nested_if_block_branch_to_immediate_inner_end_if >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ GOTO 30 >+ ELSE >+ sum = sum + sum >+30 END IF !<<<<< 16, 1, 16, 9, fail-initial >+40 CONTINUE >+10 END IF >+20 CONTINUE >+ PRINT *, 'sum:', sum >+END PROGRAM nested_if_block_branch_to_immediate_inner_end_if >Index: refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_outer_end_if/nested_if_block_branch_to_immediate_outer_end_if.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_outer_end_if/nested_if_block_branch_to_immediate_outer_end_if.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_outer_end_if/nested_if_block_branch_to_immediate_outer_end_if.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_outer_end_if/nested_if_block_branch_to_immediate_outer_end_if.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,22 @@ >+! Only GOTO targets the selected END IF for refactoring >+! but since a refactoring would not make any changes >+! by design we fail and warn the user that no change >+! would occur. (Other GOTOs target other labels.) >+ >+PROGRAM nested_if_block_branch_to_immediate_inner_end_ifsubroutine >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ GOTO 30 >+ ELSE >+ sum = sum + sum >+30 END IF >+40 CONTINUE >+ GOTO 10 >+10 END IF !<<<<< 19, 1, 19, 9, fail-initial >+20 CONTINUE >+ PRINT *, 'sum:', sum >+END PROGRAM nested_if_block_branch_to_immediate_inner_end_ifsubroutine >Index: refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_outer_end_if/nested_if_block_branch_to_immediate_outer_end_if.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_outer_end_if/nested_if_block_branch_to_immediate_outer_end_if.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_outer_end_if/nested_if_block_branch_to_immediate_outer_end_if.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/nested_if_block_branch_to_immediate_outer_end_if/nested_if_block_branch_to_immediate_outer_end_if.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,22 @@ >+! Only GOTO targets the selected END IF for refactoring >+! but since a refactoring would not make any changes >+! by design we fail and warn the user that no change >+! would occur. (Other GOTOs target other labels.) >+ >+PROGRAM nested_if_block_branch_to_immediate_inner_end_ifsubroutine >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ GOTO 30 >+ ELSE >+ sum = sum + sum >+30 END IF >+40 CONTINUE >+ GOTO 10 >+10 END IF !<<<<< 19, 1, 19, 9, fail-initial >+20 CONTINUE >+ PRINT *, 'sum:', sum >+END PROGRAM nested_if_block_branch_to_immediate_inner_end_ifsubroutine >Index: refactoring-test-code/remove-branch-to-end-if/test-branch_end_if_label/test-branch_end_if_label.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-branch_end_if_label/test-branch_end_if_label.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/test-branch_end_if_label/test-branch_end_if_label.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-branch_end_if_label/test-branch_end_if_label.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+! Outer GOTO targets selected END IF so insert >+! a CONTINUE statement and retarget its label. >+! Remove END IF label since no inner GOTO >+! statement exists >+ >+PROGRAM test_branch_end_if_label >+ INTEGER :: k, i >+ READ(*,*) k >+ IF (k.lt.10) THEN >+ GOTO 20 >+ END IF >+ i = k - 10 >+ IF (i.gt.100) THEN >+ i = i - 100 >+20 END IF !<<<<< 15, 4, 15, 9, pass >+ PRINT *, i >+END PROGRAM test_branch_end_if_label >\ No newline at end of file >Index: refactoring-test-code/remove-branch-to-end-if/test-branch_end_if_label/test-branch_end_if_label.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-branch_end_if_label/test-branch_end_if_label.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/test-branch_end_if_label/test-branch_end_if_label.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-branch_end_if_label/test-branch_end_if_label.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,18 @@ >+! Outer GOTO targets selected END IF so insert >+! a CONTINUE statement and retarget its label. >+! Remove END IF label since no inner GOTO >+! statement exists >+ >+PROGRAM test_branch_end_if_label >+ INTEGER :: k, i >+ READ(*,*) k >+ IF (k.lt.10) THEN >+ GOTO 20 >+ END IF >+ i = k - 10 >+ IF (i.gt.100) THEN >+ i = i - 100 >+ END IF !<<<<< 15, 4, 15, 9, pass >+20 CONTINUE >+ PRINT *, i >+END PROGRAM test_branch_end_if_label >Index: refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if/test-branch_to_immediate_end_if.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if/test-branch_to_immediate_end_if.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if/test-branch_to_immediate_end_if.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if/test-branch_to_immediate_end_if.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! GOTO statement is inner GOTO for selected END IF >+! so no change is expected. By design we warn the >+! user that no change will be made. >+ >+PROGRAM test_branch_to_immediate_end_if >+ INTEGER :: k, i >+ READ(*,*) k >+ IF (k.lt.10) THEN >+ GOTO 20 >+20 END IF !<<<<< 10, 1, 10, 9, fail-initial >+ i = k - 10 >+ IF (i.gt.100) THEN >+ i = i - 100 >+ END IF >+ PRINT *, i >+END PROGRAM test_branch_to_immediate_end_if >\ No newline at end of file >Index: refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if/test-branch_to_immediate_end_if.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if/test-branch_to_immediate_end_if.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if/test-branch_to_immediate_end_if.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if/test-branch_to_immediate_end_if.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! GOTO statement is inner GOTO for selected END IF >+! so no change is expected. By design we warn the >+! user that no change will be made. >+ >+PROGRAM test_branch_to_immediate_end_if >+ INTEGER :: k, i >+ READ(*,*) k >+ IF (k.lt.10) THEN >+ GOTO 20 >+20 END IF !<<<<< 10, 1, 10, 9, fail-initial >+ i = k - 10 >+ IF (i.gt.100) THEN >+ i = i - 100 >+ END IF >+ PRINT *, i >+END PROGRAM test_branch_to_immediate_end_if >\ No newline at end of file >Index: refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if_with_continue_after_end_if/test-branch_to_immediate_end_if_with_continue_after_end_if.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if_with_continue_after_end_if/test-branch_to_immediate_end_if_with_continue_after_end_if.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if_with_continue_after_end_if/test-branch_to_immediate_end_if_with_continue_after_end_if.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if_with_continue_after_end_if/test-branch_to_immediate_end_if_with_continue_after_end_if.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+! By design if no GOTOs target the END IF statement even >+! if a labels CONTINUE exists no refactoring should take >+! place and the user will be notified as such. >+ >+PROGRAM branch_to_immediate_end_if_with_continue_after_end_if >+ INTEGER :: k, i >+ READ(*,*) k >+ IF (k.lt.10) THEN >+ GOTO 20 >+20 END IF !<<<<< 10, 1, 10, 9, fail-initial >+30 CONTINUE >+ i = k - 10 >+ IF (i.gt.100) THEN >+ i = i - 100 >+ END IF >+ PRINT *, i >+END PROGRAM branch_to_immediate_end_if_with_continue_after_end_if >\ No newline at end of file >Index: refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if_with_continue_after_end_if/test-branch_to_immediate_end_if_with_continue_after_end_if.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if_with_continue_after_end_if/test-branch_to_immediate_end_if_with_continue_after_end_if.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if_with_continue_after_end_if/test-branch_to_immediate_end_if_with_continue_after_end_if.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-branch_to_immediate_end_if_with_continue_after_end_if/test-branch_to_immediate_end_if_with_continue_after_end_if.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+! By design if no GOTOs target the END IF statement even >+! if a labels CONTINUE exists no refactoring should take >+! place and the user will be notified as such. >+ >+PROGRAM branch_to_immediate_end_if_with_continue_after_end_if >+ INTEGER :: k, i >+ READ(*,*) k >+ IF (k.lt.10) THEN >+ GOTO 20 >+20 END IF !<<<<< 10, 1, 10, 9, fail-initial >+30 CONTINUE >+ i = k - 10 >+ IF (i.gt.100) THEN >+ i = i - 100 >+ END IF >+ PRINT *, i >+END PROGRAM branch_to_immediate_end_if_with_continue_after_end_if >\ No newline at end of file >Index: refactoring-test-code/remove-branch-to-end-if/test-end_if_label_between_branch_to_end_if/test-end_if_label_between_branch_to_end_if.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-end_if_label_between_branch_to_end_if/test-end_if_label_between_branch_to_end_if.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/test-end_if_label_between_branch_to_end_if/test-end_if_label_between_branch_to_end_if.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-end_if_label_between_branch_to_end_if/test-end_if_label_between_branch_to_end_if.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+! When two labeled END IF blocks the outer GOTO that >+! targets the selected END IF block should be retargetted >+! to a new CONTINUE statement and the original END IF label >+! removed but other labeled END IF should remain. >+ >+PROGRAM test_end_if_label_between_branch_to_end_if >+ INTEGER :: k, i >+ READ(*,*) k >+ IF (k.lt.10) THEN >+ GOTO 30 >+20 END IF >+ i = k - 10 >+ IF (i.gt.100) THEN >+ i = i - 100 >+30 END IF !<<<<< 15, 1, 15, 9, pass >+ PRINT *, i >+END PROGRAM test_end_if_label_between_branch_to_end_if >\ No newline at end of file >Index: refactoring-test-code/remove-branch-to-end-if/test-end_if_label_between_branch_to_end_if/test-end_if_label_between_branch_to_end_if.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-end_if_label_between_branch_to_end_if/test-end_if_label_between_branch_to_end_if.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/test-end_if_label_between_branch_to_end_if/test-end_if_label_between_branch_to_end_if.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-end_if_label_between_branch_to_end_if/test-end_if_label_between_branch_to_end_if.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,18 @@ >+! When two labeled END IF blocks the outer GOTO that >+! targets the selected END IF block should be retargetted >+! to a new CONTINUE statement and the original END IF label >+! removed but other labeled END IF should remain. >+ >+PROGRAM test_end_if_label_between_branch_to_end_if >+ INTEGER :: k, i >+ READ(*,*) k >+ IF (k.lt.10) THEN >+ GOTO 30 >+20 END IF >+ i = k - 10 >+ IF (i.gt.100) THEN >+ i = i - 100 >+ END IF !<<<<< 15, 1, 15, 9, pass >+30 CONTINUE >+ PRINT *, i >+END PROGRAM test_end_if_label_between_branch_to_end_if >Index: refactoring-test-code/remove-branch-to-end-if/test-endif_continue_branch-1/test-endif_continue_branch-1.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-endif_continue_branch-1/test-endif_continue_branch-1.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/test-endif_continue_branch-1/test-endif_continue_branch-1.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-endif_continue_branch-1/test-endif_continue_branch-1.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,20 @@ >+! With more DO and IF structures the outer GOTO >+! statement should still be retargetted to the >+! existing CONTINUE statement and then remove the >+! label of the selected END IF statement. >+ >+PROGRAM test_endif_continue_branch_1 >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ GOTO 10 >+ END IF >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ sum = sum + sum >+ GOTO 30 >+10 END IF !<<<<< 17, 1, 17, 12, pass >+20 CONTINUE >+30 PRINT *, 'sum:', sum >+END PROGRAM test_endif_continue_branch_1 >Index: refactoring-test-code/remove-branch-to-end-if/test-endif_continue_branch-1/test-endif_continue_branch-1.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-endif_continue_branch-1/test-endif_continue_branch-1.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/test-endif_continue_branch-1/test-endif_continue_branch-1.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-endif_continue_branch-1/test-endif_continue_branch-1.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,20 @@ >+! With more DO and IF structures the outer GOTO >+! statement should still be retargetted to the >+! existing CONTINUE statement and then remove the >+! label of the selected END IF statement. >+ >+PROGRAM test_endif_continue_branch_1 >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ GOTO 20 >+ END IF >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ sum = sum + sum >+ GOTO 30 >+ END IF !<<<<< 17, 1, 17, 12, pass >+20 CONTINUE >+30 PRINT *, 'sum:', sum >+END PROGRAM test_endif_continue_branch_1 >Index: refactoring-test-code/remove-branch-to-end-if/test-endif_duplicate_continue/test-endif_duplicate_continue.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-endif_duplicate_continue/test-endif_duplicate_continue.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/test-endif_duplicate_continue/test-endif_duplicate_continue.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-endif_duplicate_continue/test-endif_duplicate_continue.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,20 @@ >+! With two CONTINUE statements (unique labels) the >+! outter GOTO statement should be refactored to target >+! the CONTINUE statement immediately following the >+! selected END IF statement. >+ >+PROGRAM test_endif_duplicate_continue >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ GOTO 10 >+ END IF >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ sum = sum + sum >+10 END IF !<<<<< 16, 1, 16, 12, pass >+20 CONTINUE >+30 CONTINUE >+40 PRINT *, 'sum:', sum >+END PROGRAM test_endif_duplicate_continue >Index: refactoring-test-code/remove-branch-to-end-if/test-endif_duplicate_continue/test-endif_duplicate_continue.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-endif_duplicate_continue/test-endif_duplicate_continue.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/test-endif_duplicate_continue/test-endif_duplicate_continue.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-endif_duplicate_continue/test-endif_duplicate_continue.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,20 @@ >+! With two CONTINUE statements (unique labels) the >+! outter GOTO statement should be refactored to target >+! the CONTINUE statement immediately following the >+! selected END IF statement. >+ >+PROGRAM test_endif_duplicate_continue >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ GOTO 20 >+ END IF >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ sum = sum + sum >+ END IF !<<<<< 16, 1, 16, 12, pass >+20 CONTINUE >+30 CONTINUE >+40 PRINT *, 'sum:', sum >+END PROGRAM test_endif_duplicate_continue >Index: refactoring-test-code/remove-branch-to-end-if/test-invalid_selection/test-invalid_selection.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-invalid_selection/test-invalid_selection.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/test-invalid_selection/test-invalid_selection.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-invalid_selection/test-invalid_selection.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! Refactoring requires that a labeled END IF is selected. >+! This test checks when user selects something else >+! the refactoring should not proceed. >+ >+PROGRAM test_invalid_selection >+ INTEGER :: k, i >+ READ(*,*) k >+ IF (k.lt.10) THEN >+ PRINT *, k >+20 END IF >+ i = k - 10 >+ IF (i.gt.100) THEN >+ i = i - 100 >+30 END IF >+ PRINT *, i !<<<<< 15, 4, 15, 14, fail-initial >+END PROGRAM test_invalid_selection >Index: refactoring-test-code/remove-branch-to-end-if/test-invalid_selection/test-invalid_selection.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-invalid_selection/test-invalid_selection.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/test-invalid_selection/test-invalid_selection.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-invalid_selection/test-invalid_selection.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! Refactoring requires that a labeled END IF is selected. >+! This test checks when user selects something else >+! the refactoring should not proceed. >+ >+PROGRAM test_invalid_selection >+ INTEGER :: k, i >+ READ(*,*) k >+ IF (k.lt.10) THEN >+ PRINT *, k >+20 END IF >+ i = k - 10 >+ IF (i.gt.100) THEN >+ i = i - 100 >+30 END IF >+ PRINT *, i !<<<<< 15, 4, 15, 14, fail-initial >+END PROGRAM test_invalid_selection >Index: refactoring-test-code/remove-branch-to-end-if/test-nested_if_blocks/test-nested_if_blocks.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-nested_if_blocks/test-nested_if_blocks.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/test-nested_if_blocks/test-nested_if_blocks.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-nested_if_blocks/test-nested_if_blocks.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+! Even with more complicated nested IF and DO structure >+! since any GOTO inside any statements of the selected >+! END IF line are considered inner IFs then it should >+! be retargetted to the following CONTINIUE statement >+! and the original END IF label removed. >+ >+PROGRAM test_nested_if_blocks >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ GOTO 10 >+ ELSE >+ sum = sum + sum >+ END IF >+10 END IF !<<<<< 18, 1, 18, 10, fail-initial >+20 CONTINUE >+ PRINT *, 'sum:', sum >+END PROGRAM test_nested_if_blocks >Index: refactoring-test-code/remove-branch-to-end-if/test-nested_if_blocks/test-nested_if_blocks.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-nested_if_blocks/test-nested_if_blocks.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/test-nested_if_blocks/test-nested_if_blocks.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-nested_if_blocks/test-nested_if_blocks.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+! Even with more complicated nested IF and DO structure >+! since any GOTO inside any statements of the selected >+! END IF line are considered inner IFs then it should >+! be retargetted to the following CONTINIUE statement >+! and the original END IF label removed. >+ >+PROGRAM test_nested_if_blocks >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ GOTO 10 >+ ELSE >+ sum = sum + sum >+ END IF >+10 END IF !<<<<< 18, 1, 18, 10, fail-initial >+20 CONTINUE >+ PRINT *, 'sum:', sum >+END PROGRAM test_nested_if_blocks >Index: refactoring-test-code/remove-branch-to-end-if/test-no_branch_to_end_if_label/test-no_branch_to_end_if_label.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-no_branch_to_end_if_label/test-no_branch_to_end_if_label.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/test-no_branch_to_end_if_label/test-no_branch_to_end_if_label.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-no_branch_to_end_if_label/test-no_branch_to_end_if_label.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! Test if no GOTOs exist in PROGRAM then no change >+! will occur from the refactoring so the user is >+! warned and the refactoring halted. >+ >+PROGRAM test_no_branch_to_end_if_label >+ INTEGER :: k, i >+ READ(*,*) k >+ IF (k.lt.10) THEN >+ PRINT *, k >+20 END IF >+ i = k - 10 >+ IF (i.gt.100) THEN >+ i = i - 100 >+30 END IF !<<<<< 14, 1, 14, 9, fail-initial >+ PRINT *, i >+END PROGRAM test_no_branch_to_end_if_label >\ No newline at end of file >Index: refactoring-test-code/remove-branch-to-end-if/test-no_branch_to_end_if_label/test-no_branch_to_end_if_label.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-no_branch_to_end_if_label/test-no_branch_to_end_if_label.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/test-no_branch_to_end_if_label/test-no_branch_to_end_if_label.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-no_branch_to_end_if_label/test-no_branch_to_end_if_label.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! Test if no GOTOs exist in PROGRAM then no change >+! will occur from the refactoring so the user is >+! warned and the refactoring halted. >+ >+PROGRAM test_no_branch_to_end_if_label >+ INTEGER :: k, i >+ READ(*,*) k >+ IF (k.lt.10) THEN >+ PRINT *, k >+20 END IF >+ i = k - 10 >+ IF (i.gt.100) THEN >+ i = i - 100 >+30 END IF !<<<<< 14, 1, 14, 9, fail-initial >+ PRINT *, i >+END PROGRAM test_no_branch_to_end_if_label >\ No newline at end of file >Index: refactoring-test-code/remove-branch-to-end-if/test-numbered_statement_after_continue/test-numbered_statement_after_continue.f90 >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-numbered_statement_after_continue/test-numbered_statement_after_continue.f90 >diff -N refactoring-test-code/remove-branch-to-end-if/test-numbered_statement_after_continue/test-numbered_statement_after_continue.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-numbered_statement_after_continue/test-numbered_statement_after_continue.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,20 @@ >+! GOTO statement is an outer IF block so existing CONTINIUE >+! statement is targetted and since no inner GOTOs remain >+! END if label is removed. (more complicated DO/IF structure >+! to make sure refactoring is unaffected by other program >+! structures.) >+ >+PROGRAM test_numbered_statement_after_continue >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ GOTO 10 >+ END IF >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ sum = sum + sum >+10 END IF !<<<<< 17, 1, 17, 12, pass >+20 CONTINUE >+30 PRINT *, 'sum:', sum >+END PROGRAM test_numbered_statement_after_continue >Index: refactoring-test-code/remove-branch-to-end-if/test-numbered_statement_after_continue/test-numbered_statement_after_continue.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-branch-to-end-if/test-numbered_statement_after_continue/test-numbered_statement_after_continue.f90.result >diff -N refactoring-test-code/remove-branch-to-end-if/test-numbered_statement_after_continue/test-numbered_statement_after_continue.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-branch-to-end-if/test-numbered_statement_after_continue/test-numbered_statement_after_continue.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,20 @@ >+! GOTO statement is an outer IF block so existing CONTINIUE >+! statement is targetted and since no inner GOTOs remain >+! END if label is removed. (more complicated DO/IF structure >+! to make sure refactoring is unaffected by other program >+! structures.) >+ >+PROGRAM test_numbered_statement_after_continue >+ INTEGER :: sum, i >+ sum = 0 >+ DO 20, i = 1, 10 >+ IF (MOD(i,2).eq.0) THEN >+ GOTO 20 >+ END IF >+ sum = sum + i >+ IF (sum.ge.100) THEN >+ sum = sum + sum >+ END IF !<<<<< 17, 1, 17, 12, pass >+20 CONTINUE >+30 PRINT *, 'sum:', sum >+END PROGRAM test_numbered_statement_after_continue >Index: refactoring-test-code/remove-pause-stmt/pause_as_only_stmt/pause_as_only_stmt.f90 >=================================================================== >RCS file: refactoring-test-code/remove-pause-stmt/pause_as_only_stmt/pause_as_only_stmt.f90 >diff -N refactoring-test-code/remove-pause-stmt/pause_as_only_stmt/pause_as_only_stmt.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-pause-stmt/pause_as_only_stmt/pause_as_only_stmt.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,6 @@ >+! Checks for basic replacement of a PAUSE statement >+! with PRINT and READ. >+ >+PROGRAM pause_as_only_stmt >+ PAUSE 'mid job' !<<<<< 5, 5, 5, 7, pass >+END PROGRAM pause_as_only_stmt >Index: refactoring-test-code/remove-pause-stmt/pause_as_only_stmt/pause_as_only_stmt.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-pause-stmt/pause_as_only_stmt/pause_as_only_stmt.f90.result >diff -N refactoring-test-code/remove-pause-stmt/pause_as_only_stmt/pause_as_only_stmt.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-pause-stmt/pause_as_only_stmt/pause_as_only_stmt.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,7 @@ >+! Checks for basic replacement of a PAUSE statement >+! with PRINT and READ. >+ >+PROGRAM pause_as_only_stmt >+ PRINT *, 'mid job' !<<<<< 5, 5, 5, 7, pass >+ READ (*, *) >+END PROGRAM pause_as_only_stmt >Index: refactoring-test-code/remove-pause-stmt/pause_in_subroutine/pause_in_subroutine.f90 >=================================================================== >RCS file: refactoring-test-code/remove-pause-stmt/pause_in_subroutine/pause_in_subroutine.f90 >diff -N refactoring-test-code/remove-pause-stmt/pause_in_subroutine/pause_in_subroutine.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-pause-stmt/pause_in_subroutine/pause_in_subroutine.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,18 @@ >+! Checks for basic replacement of a PAUSE statement >+! with PRINT and READ while PAUSE statement is in >+! unit other than PROGRAM, e.g. SUBROUTINE. >+ >+PROGRAM PauseInSubroutine >+ INTEGER :: i >+ DO i = 1, 100 >+ IF (i == 50) THEN >+ CALL CALLPRINT >+ END IF >+ END DO >+ PRINT *, 'i=', i >+END PROGRAM PauseInSubroutine >+ >+ >+SUBROUTINE CALLPRINT >+ PAUSE 'mid job' !<<<<< 17, 4, 17, 19, pass >+END >Index: refactoring-test-code/remove-pause-stmt/pause_in_subroutine/pause_in_subroutine.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-pause-stmt/pause_in_subroutine/pause_in_subroutine.f90.result >diff -N refactoring-test-code/remove-pause-stmt/pause_in_subroutine/pause_in_subroutine.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-pause-stmt/pause_in_subroutine/pause_in_subroutine.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+! Checks for basic replacement of a PAUSE statement >+! with PRINT and READ while PAUSE statement is in >+! unit other than PROGRAM, e.g. SUBROUTINE. >+ >+PROGRAM PauseInSubroutine >+ INTEGER :: i >+ DO i = 1, 100 >+ IF (i == 50) THEN >+ CALL CALLPRINT >+ END IF >+ END DO >+ PRINT *, 'i=', i >+END PROGRAM PauseInSubroutine >+ >+ >+SUBROUTINE CALLPRINT >+ PRINT *, 'mid job' !<<<<< 17, 4, 17, 19, pass >+ READ (*, *) >+END >Index: refactoring-test-code/remove-pause-stmt/pause_nested_in_if_and_do_loop/pause_nested_in_if_and_do_loop.f90 >=================================================================== >RCS file: refactoring-test-code/remove-pause-stmt/pause_nested_in_if_and_do_loop/pause_nested_in_if_and_do_loop.f90 >diff -N refactoring-test-code/remove-pause-stmt/pause_nested_in_if_and_do_loop/pause_nested_in_if_and_do_loop.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-pause-stmt/pause_nested_in_if_and_do_loop/pause_nested_in_if_and_do_loop.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,14 @@ >+! Checks for replacement of a PAUSE statement >+! with PRINT and READ while PAUSE statement is in >+! a nested DO/IF block to make sure there are no >+! dependencies on surrounding code. >+ >+PROGRAM pause_nested_in_if_and_do_loop >+ INTEGER :: i >+ DO i = 1, 100 >+ IF (i == 50) THEN >+ PAUSE 'mid job' !<<<<< 10, 7, 10, 21, pass >+ END IF >+ END DO >+ PRINT *, 'i=', i >+END PROGRAM pause_nested_in_if_and_do_loop >Index: refactoring-test-code/remove-pause-stmt/pause_nested_in_if_and_do_loop/pause_nested_in_if_and_do_loop.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-pause-stmt/pause_nested_in_if_and_do_loop/pause_nested_in_if_and_do_loop.f90.result >diff -N refactoring-test-code/remove-pause-stmt/pause_nested_in_if_and_do_loop/pause_nested_in_if_and_do_loop.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-pause-stmt/pause_nested_in_if_and_do_loop/pause_nested_in_if_and_do_loop.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,15 @@ >+! Checks for replacement of a PAUSE statement >+! with PRINT and READ while PAUSE statement is in >+! a nested DO/IF block to make sure there are no >+! dependencies on surrounding code. >+ >+PROGRAM pause_nested_in_if_and_do_loop >+ INTEGER :: i >+ DO i = 1, 100 >+ IF (i == 50) THEN >+ PRINT *, 'mid job' !<<<<< 10, 7, 10, 21, pass >+ READ (*, *) >+ END IF >+ END DO >+ PRINT *, 'i=', i >+END PROGRAM pause_nested_in_if_and_do_loop >Index: refactoring-test-code/remove-pause-stmt/pause_no_message/pause_no_message.f90 >=================================================================== >RCS file: refactoring-test-code/remove-pause-stmt/pause_no_message/pause_no_message.f90 >diff -N refactoring-test-code/remove-pause-stmt/pause_no_message/pause_no_message.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-pause-stmt/pause_no_message/pause_no_message.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,13 @@ >+! Check when no PAUSE message provided that >+! an empty string is inserted in the >+! final refactoring. >+ >+PROGRAM pause_no_message >+ INTEGER :: i >+ DO i = 1, 100 >+ IF (i == 50) THEN >+ PAUSE !<<<<< 9, 7, 9, 11, pass >+ END IF >+ END DO >+ PRINT *, 'i=', i >+END PROGRAM pause_no_message >\ No newline at end of file >Index: refactoring-test-code/remove-pause-stmt/pause_no_message/pause_no_message.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-pause-stmt/pause_no_message/pause_no_message.f90.result >diff -N refactoring-test-code/remove-pause-stmt/pause_no_message/pause_no_message.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-pause-stmt/pause_no_message/pause_no_message.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,14 @@ >+! Check when no PAUSE message provided that >+! an empty string is inserted in the >+! final refactoring. >+ >+PROGRAM pause_no_message >+ INTEGER :: i >+ DO i = 1, 100 >+ IF (i == 50) THEN >+ PRINT *, '' !<<<<< 9, 7, 9, 11, pass >+ READ (*, *) >+ END IF >+ END DO >+ PRINT *, 'i=', i >+END PROGRAM pause_no_message >Index: refactoring-test-code/remove-pause-stmt/pause_not_selected/pause_not_selected.f90 >=================================================================== >RCS file: refactoring-test-code/remove-pause-stmt/pause_not_selected/pause_not_selected.f90 >diff -N refactoring-test-code/remove-pause-stmt/pause_not_selected/pause_not_selected.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-pause-stmt/pause_not_selected/pause_not_selected.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,13 @@ >+! Refactoring requires that PAUSE statement be >+! selected. Check that no refactoring occurs >+! when PAUSE is not selected. >+ >+PROGRAM pause_not_selected >+ INTEGER :: i >+ DO i = 1, 100 >+ IF (i == 50) THEN >+ PAUSE 'mid job' >+ END IF >+ END DO >+ PRINT *, 'i=', i !<<<<< 12, 3, 12, 5, fail-initial >+END PROGRAM pause_not_selected >Index: refactoring-test-code/remove-pause-stmt/pause_not_selected/pause_not_selected.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-pause-stmt/pause_not_selected/pause_not_selected.f90.result >diff -N refactoring-test-code/remove-pause-stmt/pause_not_selected/pause_not_selected.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-pause-stmt/pause_not_selected/pause_not_selected.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,13 @@ >+! Refactoring requires that PAUSE statement be >+! selected. Check that no refactoring occurs >+! when PAUSE is not selected. >+ >+PROGRAM pause_not_selected >+ INTEGER :: i >+ DO i = 1, 100 >+ IF (i == 50) THEN >+ PAUSE 'mid job' >+ END IF >+ END DO >+ PRINT *, 'i=', i !<<<<< 12, 3, 12, 5, fail-initial >+END PROGRAM pause_not_selected >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/equal-lb-ub/equal-lb-ub.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/equal-lb-ub/equal-lb-ub.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/equal-lb-ub/equal-lb-ub.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/equal-lb-ub/equal-lb-ub.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,11 @@ >+! When upper and lower bounds are the same value >+! refactoring should proceed with same value used. >+ >+PROGRAM EqualLbUb >+ REAL :: counter, sum >+ sum = 0.0 >+ DO counter = 1.2, 1.2, 0.1 !<<<<< 7, 3, 7, 29, 0, pass >+ sum = sum + counter >+ END DO >+ PRINT *, sum >+END PROGRAM EqualLbUb >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/equal-lb-ub/equal-lb-ub.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/equal-lb-ub/equal-lb-ub.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/equal-lb-ub/equal-lb-ub.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/equal-lb-ub/equal-lb-ub.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! When upper and lower bounds are the same value >+! refactoring should proceed with same value used. >+ >+PROGRAM EqualLbUb >+ REAL :: counter, sum >+ sum = 0.0 >+ counter = 1.2 >+ DO !<<<<< 7, 3, 7, 29, 0, pass >+ sum = sum + counter >+ counter = counter - 0.1 >+ IF(counter < 1.2) THEN >+ EXIT >+ END IF >+ END DO >+ PRINT *, sum >+END PROGRAM EqualLbUb >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/integer-control-variable/integer-control-variable.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/integer-control-variable/integer-control-variable.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/integer-control-variable/integer-control-variable.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/integer-control-variable/integer-control-variable.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,12 @@ >+! Loop control variable declared as an INTEGER. >+! Refactoring explicitly requires a REAL or DOUBLE >+! type to proceed. >+ >+PROGRAM IntegerControlVariable >+ INTEGER :: counter, sum >+ sum = 0 >+ DO counter = 1, 10, 1 !<<<<< 8, 3, 8, 24, 0, fail-final >+ sum = sum + counter >+ END DO >+ PRINT *, sum >+END PROGRAM IntegerControlVariable >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/integer-control-variable/integer-control-variable.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/integer-control-variable/integer-control-variable.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/integer-control-variable/integer-control-variable.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/integer-control-variable/integer-control-variable.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,12 @@ >+! Loop control variable declared as an INTEGER. >+! Refactoring explicitly requires a REAL or DOUBLE >+! type to proceed. >+ >+PROGRAM IntegerControlVariable >+ INTEGER :: counter, sum >+ sum = 0 >+ DO counter = 1, 10, 1 !<<<<< 8, 3, 8, 24, 0, fail-final >+ sum = sum + counter >+ END DO >+ PRINT *, sum >+END PROGRAM IntegerControlVariable >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-do-while/nested-do-double-inner-decrement-do-while.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-do-while/nested-do-double-inner-decrement-do-while.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-do-while/nested-do-double-inner-decrement-do-while.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-do-while/nested-do-double-inner-decrement-do-while.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - DOUBLE data type >+! and decrement behavior - explicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoDoubleInnerDecrementDoWhile >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ DO counterin = 1.8, 1.2, 0.1 !<<<<< 12, 5, 12, 33, 1, pass >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleInnerDecrementDoWhile >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-do-while/nested-do-double-inner-decrement-do-while.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-do-while/nested-do-double-inner-decrement-do-while.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-do-while/nested-do-double-inner-decrement-do-while.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-do-while/nested-do-double-inner-decrement-do-while.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - DOUBLE data type >+! and decrement behavior - explicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoDoubleInnerDecrementDoWhile >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ counterin = 1.8 >+ DO WHILE (counterin >= 1.2) !<<<<< 12, 5, 12, 33, 1, pass >+ sumin = sumin + counterin >+ counterin = counterin - 0.1 >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleInnerDecrementDoWhile >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit-do-while/nested-do-double-inner-decrement-implicit-do-while.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit-do-while/nested-do-double-inner-decrement-implicit-do-while.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit-do-while/nested-do-double-inner-decrement-implicit-do-while.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit-do-while/nested-do-double-inner-decrement-implicit-do-while.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - DOUBLE data type >+! and decrement behavior - implicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoDoubleInnerDecrementImplicit >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ DO counterin = 1.8, 1.2 !<<<<< 12, 5, 12, 33, 1, pass >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleInnerDecrementImplicit >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit-do-while/nested-do-double-inner-decrement-implicit-do-while.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit-do-while/nested-do-double-inner-decrement-implicit-do-while.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit-do-while/nested-do-double-inner-decrement-implicit-do-while.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit-do-while/nested-do-double-inner-decrement-implicit-do-while.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - DOUBLE data type >+! and decrement behavior - implicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoDoubleInnerDecrementImplicit >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ counterin = 1.8 >+ DO WHILE (counterin >= 1.2) !<<<<< 12, 5, 12, 33, 1, pass >+ sumin = sumin + counterin >+ counterin = counterin - 1 >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleInnerDecrementImplicit >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit/nested-do-double-inner-decrement-implicit.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit/nested-do-double-inner-decrement-implicit.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit/nested-do-double-inner-decrement-implicit.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit/nested-do-double-inner-decrement-implicit.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - DOUBLE data type >+! and decrement behavior - implicit step count. >+ >+PROGRAM NestedDoDoubleInnerDecrementImplicit >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ DO counterin = 1.8, 1.2 !<<<<< 11, 5, 11, 33, 0, pass >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleInnerDecrementImplicit >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit/nested-do-double-inner-decrement-implicit.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit/nested-do-double-inner-decrement-implicit.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit/nested-do-double-inner-decrement-implicit.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement-implicit/nested-do-double-inner-decrement-implicit.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - DOUBLE data type >+! and decrement behavior - implicit step count. >+ >+PROGRAM NestedDoDoubleInnerDecrementImplicit >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ counterin = 1.8 >+ DO !<<<<< 11, 5, 11, 33, 0, pass >+ sumin = sumin + counterin >+ counterin = counterin - 1 >+ IF(counterin < 1.2) THEN >+ EXIT >+ END IF >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleInnerDecrementImplicit >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement/nested-do-double-inner-decrement.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement/nested-do-double-inner-decrement.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement/nested-do-double-inner-decrement.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement/nested-do-double-inner-decrement.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - DOUBLE data type >+! and decrement behavior - explicit step count. >+ >+PROGRAM NestedDoDoubleInnerDecrement >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ DO counterin = 1.8, 1.2, 0.1 !<<<<< 11, 5, 11, 33, 0, pass >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleInnerDecrement >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement/nested-do-double-inner-decrement.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement/nested-do-double-inner-decrement.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement/nested-do-double-inner-decrement.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-inner-decrement/nested-do-double-inner-decrement.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - DOUBLE data type >+! and decrement behavior - explicit step count. >+ >+PROGRAM NestedDoDoubleInnerDecrement >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ counterin = 1.8 >+ DO !<<<<< 11, 5, 11, 33, 0, pass >+ sumin = sumin + counterin >+ counterin = counterin - 0.1 >+ IF(counterin < 1.2) THEN >+ EXIT >+ END IF >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleInnerDecrement >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-do-while/nested-do-double-outer-increment-do-while.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-do-while/nested-do-double-outer-increment-do-while.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-do-while/nested-do-double-outer-increment-do-while.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-do-while/nested-do-double-outer-increment-do-while.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - DOUBLE data type >+! and increment behavior - explicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoDoubleOuterIncrement >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 !<<<<< 10, 3, 10, 29, 1, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleOuterIncrement >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-do-while/nested-do-double-outer-increment-do-while.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-do-while/nested-do-double-outer-increment-do-while.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-do-while/nested-do-double-outer-increment-do-while.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-do-while/nested-do-double-outer-increment-do-while.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - DOUBLE data type >+! and increment behavior - explicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoDoubleOuterIncrement >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ counter = 1.2 >+ DO WHILE (counter <= 1.8) !<<<<< 10, 3, 10, 29, 1, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ counter = counter + 0.1 >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleOuterIncrement >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit-do-while/nested-do-double-outer-increment-implicit-do-while.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit-do-while/nested-do-double-outer-increment-implicit-do-while.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit-do-while/nested-do-double-outer-increment-implicit-do-while.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit-do-while/nested-do-double-outer-increment-implicit-do-while.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - DOUBLE data type >+! and increment behavior - implicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoDoubleOuterIncrementImplicit >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8 !<<<<< 10, 3, 10, 29, 1, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleOuterIncrementImplicit >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit-do-while/nested-do-double-outer-increment-implicit-do-while.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit-do-while/nested-do-double-outer-increment-implicit-do-while.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit-do-while/nested-do-double-outer-increment-implicit-do-while.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit-do-while/nested-do-double-outer-increment-implicit-do-while.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - DOUBLE data type >+! and increment behavior - implicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoDoubleOuterIncrementImplicit >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ counter = 1.2 >+ DO WHILE (counter <= 1.8) !<<<<< 10, 3, 10, 29, 1, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ counter = counter + 1 >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleOuterIncrementImplicit >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit/nested-do-double-outer-increment-implicit.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit/nested-do-double-outer-increment-implicit.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit/nested-do-double-outer-increment-implicit.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit/nested-do-double-outer-increment-implicit.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - DOUBLE data type >+! and increment behavior - implicit step count. >+ >+PROGRAM NestedDoDoubleOuterIncrementImplicit >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8 !<<<<< 9, 3, 9, 29, 0, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleOuterIncrementImplicit >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit/nested-do-double-outer-increment-implicit.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit/nested-do-double-outer-increment-implicit.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit/nested-do-double-outer-increment-implicit.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment-implicit/nested-do-double-outer-increment-implicit.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - DOUBLE data type >+! and increment behavior - implicit step count. >+ >+PROGRAM NestedDoDoubleOuterIncrementImplicit >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ counter = 1.2 >+ DO !<<<<< 9, 3, 9, 29, 0, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ counter = counter + 1 >+ IF(counter > 1.8) THEN >+ EXIT >+ END IF >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleOuterIncrementImplicit >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment/nested-do-double-outer-increment.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment/nested-do-double-outer-increment.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment/nested-do-double-outer-increment.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment/nested-do-double-outer-increment.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - DOUBLE data type >+! and increment behavior - explicit step count. >+ >+PROGRAM NestedDoDoubleOuterIncrement >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 !<<<<< 9, 3, 9, 29, 0, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleOuterIncrement >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment/nested-do-double-outer-increment.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment/nested-do-double-outer-increment.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment/nested-do-double-outer-increment.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-double-outer-increment/nested-do-double-outer-increment.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - DOUBLE data type >+! and increment behavior - explicit step count. >+ >+PROGRAM NestedDoDoubleOuterIncrement >+ DOUBLE PRECISION :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ counter = 1.2 >+ DO !<<<<< 9, 3, 9, 29, 0, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ counter = counter + 0.1 >+ IF(counter > 1.8) THEN >+ EXIT >+ END IF >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoDoubleOuterIncrement >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-do-while/nested-do-real-inner-decrement-do-while.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-do-while/nested-do-real-inner-decrement-do-while.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-do-while/nested-do-real-inner-decrement-do-while.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-do-while/nested-do-real-inner-decrement-do-while.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - REAL data type >+! and decrement behavior - explicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoRealInnerDecrement >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ DO counterin = 1.8, 1.2, 0.1 !<<<<< 12, 5, 12, 33, 1, pass >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRealInnerDecrement >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-do-while/nested-do-real-inner-decrement-do-while.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-do-while/nested-do-real-inner-decrement-do-while.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-do-while/nested-do-real-inner-decrement-do-while.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-do-while/nested-do-real-inner-decrement-do-while.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - REAL data type >+! and decrement behavior - explicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoRealInnerDecrement >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ counterin = 1.8 >+ DO WHILE (counterin >= 1.2) !<<<<< 12, 5, 12, 33, 1, pass >+ sumin = sumin + counterin >+ counterin = counterin - 0.1 >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRealInnerDecrement >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit-do-while/nested-do-real-inner-decrement-implicit-do-while.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit-do-while/nested-do-real-inner-decrement-implicit-do-while.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit-do-while/nested-do-real-inner-decrement-implicit-do-while.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit-do-while/nested-do-real-inner-decrement-implicit-do-while.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - REAL data type >+! and decrement behavior - implicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoRealInnerDecrementImplicit >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ DO counterin = 1.8, 1.2 !<<<<< 12, 5, 12, 33, 1, pass >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRealInnerDecrementImplicit >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit-do-while/nested-do-real-inner-decrement-implicit-do-while.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit-do-while/nested-do-real-inner-decrement-implicit-do-while.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit-do-while/nested-do-real-inner-decrement-implicit-do-while.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit-do-while/nested-do-real-inner-decrement-implicit-do-while.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - REAL data type >+! and decrement behavior - implicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoRealInnerDecrementImplicit >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ counterin = 1.8 >+ DO WHILE (counterin >= 1.2) !<<<<< 12, 5, 12, 33, 1, pass >+ sumin = sumin + counterin >+ counterin = counterin - 1 >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRealInnerDecrementImplicit >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit/nested-do-real-inner-decrement-implicit.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit/nested-do-real-inner-decrement-implicit.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit/nested-do-real-inner-decrement-implicit.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit/nested-do-real-inner-decrement-implicit.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - REAL data type >+! and decrement behavior - implicit step count. >+ >+PROGRAM NestedDoRealInnerDecrementImplicit >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ DO counterin = 1.8, 1.2 !<<<<< 11, 5, 11, 33, 0, pass >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRealInnerDecrementImplicit >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit/nested-do-real-inner-decrement-implicit.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit/nested-do-real-inner-decrement-implicit.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit/nested-do-real-inner-decrement-implicit.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement-implicit/nested-do-real-inner-decrement-implicit.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - REAL data type >+! and decrement behavior - implicit step count. >+ >+PROGRAM NestedDoRealInnerDecrementImplicit >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ counterin = 1.8 >+ DO !<<<<< 11, 5, 11, 33, 0, pass >+ sumin = sumin + counterin >+ counterin = counterin - 1 >+ IF(counterin < 1.2) THEN >+ EXIT >+ END IF >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRealInnerDecrementImplicit >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement/nested-do-real-inner-decrement.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement/nested-do-real-inner-decrement.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement/nested-do-real-inner-decrement.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement/nested-do-real-inner-decrement.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - REAL data type >+! and decrement behavior - explicit step count. >+ >+PROGRAM NestedDoRealInnerDecrement >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ DO counterin = 1.8, 1.2, 0.1 !<<<<< 11, 5, 11, 33, 0, pass >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRealInnerDecrement >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement/nested-do-real-inner-decrement.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement/nested-do-real-inner-decrement.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement/nested-do-real-inner-decrement.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-inner-decrement/nested-do-real-inner-decrement.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select inner DO loop - REAL data type >+! and decrement behavior - explicit step count. >+ >+PROGRAM NestedDoRealInnerDecrement >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ counterin = 1.8 >+ DO !<<<<< 11, 5, 11, 33, 0, pass >+ sumin = sumin + counterin >+ counterin = counterin - 0.1 >+ IF(counterin < 1.2) THEN >+ EXIT >+ END IF >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRealInnerDecrement >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-do-while/nested-do-real-outer-increment-do-while.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-do-while/nested-do-real-outer-increment-do-while.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-do-while/nested-do-real-outer-increment-do-while.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-do-while/nested-do-real-outer-increment-do-while.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - REAL data type >+! and decrement behavior - explicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoRealOuterIncrement >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 !<<<<< 10, 3, 10, 29, 1, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRalOuterIncrement >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-do-while/nested-do-real-outer-increment-do-while.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-do-while/nested-do-real-outer-increment-do-while.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-do-while/nested-do-real-outer-increment-do-while.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-do-while/nested-do-real-outer-increment-do-while.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - REAL data type >+! and decrement behavior - explicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoRealOuterIncrement >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ counter = 1.2 >+ DO WHILE (counter <= 1.8) !<<<<< 10, 3, 10, 29, 1, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ counter = counter + 0.1 >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRalOuterIncrement >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit-do-while/nested-do-real-outer-increment-implicit-do-while.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit-do-while/nested-do-real-outer-increment-implicit-do-while.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit-do-while/nested-do-real-outer-increment-implicit-do-while.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit-do-while/nested-do-real-outer-increment-implicit-do-while.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,17 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - REAL data type >+! and decrement behavior - implicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoRealOuterIncrementImplicitDoWhile >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8 !<<<<< 10, 3, 10, 29, 1, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRealOuterIncrementImplicitDoWhile >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit-do-while/nested-do-real-outer-increment-implicit-do-while.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit-do-while/nested-do-real-outer-increment-implicit-do-while.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit-do-while/nested-do-real-outer-increment-implicit-do-while.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit-do-while/nested-do-real-outer-increment-implicit-do-while.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,19 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - REAL data type >+! and decrement behavior - implicit step count. >+! (This test selecting to replace with DO WHILE loop.) >+ >+PROGRAM NestedDoRealOuterIncrementImplicitDoWhile >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ counter = 1.2 >+ DO WHILE (counter <= 1.8) !<<<<< 10, 3, 10, 29, 1, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ counter = counter + 1 >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRealOuterIncrementImplicitDoWhile >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit/nested-do-real-outer-increment-implicit.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit/nested-do-real-outer-increment-implicit.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit/nested-do-real-outer-increment-implicit.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit/nested-do-real-outer-increment-implicit.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - REAL data type >+! and decrement behavior - implicit step count. >+ >+PROGRAM NestedDoRealOuterIncrementImplicit >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8 !<<<<< 9, 3, 9, 29, 0, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRalOuterIncrementImplicit >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit/nested-do-real-outer-increment-implicit.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit/nested-do-real-outer-increment-implicit.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit/nested-do-real-outer-increment-implicit.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment-implicit/nested-do-real-outer-increment-implicit.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - REAL data type >+! and decrement behavior - implicit step count. >+ >+PROGRAM NestedDoRealOuterIncrementImplicit >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ counter = 1.2 >+ DO !<<<<< 9, 3, 9, 29, 0, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ counter = counter + 1 >+ IF(counter > 1.8) THEN >+ EXIT >+ END IF >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRalOuterIncrementImplicit >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment/nested-do-real-outer-increment.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment/nested-do-real-outer-increment.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment/nested-do-real-outer-increment.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment/nested-do-real-outer-increment.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - REAL data type >+! and decrement behavior - explicit step count. >+ >+PROGRAM NestedDoRealOuterIncrement >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ DO counter = 1.2, 1.8, 0.1 !<<<<< 9, 3, 9, 29, 0, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRalOuterIncrement >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment/nested-do-real-outer-increment.f90.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment/nested-do-real-outer-increment.f90.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment/nested-do-real-outer-increment.f90.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/nested-do-real-outer-increment/nested-do-real-outer-increment.f90.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,21 @@ >+! Check that nested DO loop doesn't affect refactoring >+! behavior. Select outer DO loop - REAL data type >+! and decrement behavior - explicit step count. >+ >+PROGRAM NestedDoRealOuterIncrement >+ REAL :: counter, sum, counterin, sumin >+ sum = 0.0 >+ sumin = 0.0 >+ counter = 1.2 >+ DO !<<<<< 9, 3, 9, 29, 0, pass >+ sum = sum + counter >+ DO counterin = 1.2, 1.8, 0.1 >+ sumin = sumin + counterin >+ END DO >+ counter = counter + 0.1 >+ IF(counter > 1.8) THEN >+ EXIT >+ END IF >+ END DO >+ PRINT *, sum >+END PROGRAM NestedDoRalOuterIncrement >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/test-invalid-selection/test-invalid-selection.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/test-invalid-selection/test-invalid-selection.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/test-invalid-selection/test-invalid-selection.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/test-invalid-selection/test-invalid-selection.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,11 @@ >+! Controlled DO loop must be selected for refactoring. >+! Test invalid selection that refactoring will no proceed. >+ >+PROGRAM TestInvalidSelection >+ REAL :: counter, sum >+ sum = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ END DO >+ PRINT *, sum !<<<<< 10,3,10,15, 0, fail-final >+END PROGRAM TestInvalidSelection >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/test-invalid-selection/test-invalid-selection.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/test-invalid-selection/test-invalid-selection.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/test-invalid-selection/test-invalid-selection.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/test-invalid-selection/test-invalid-selection.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,11 @@ >+! Controlled DO loop must be selected for refactoring. >+! Test invalid selection that refactoring will no proceed. >+ >+PROGRAM TestInvalidSelection >+ REAL :: counter, sum >+ sum = 0.0 >+ DO counter = 1.2, 1.8, 0.1 >+ sum = sum + counter >+ END DO >+ PRINT *, sum !<<<<< 10,3,10,15, 0, fail-final >+END PROGRAM TestInvalidSelection >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/uncontrolled-do-loop/uncontrolled-do-loop.f90 >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/uncontrolled-do-loop/uncontrolled-do-loop.f90 >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/uncontrolled-do-loop/uncontrolled-do-loop.f90 >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/uncontrolled-do-loop/uncontrolled-do-loop.f90 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! DO loop selected for refactoring must be a controlled >+! DO loop otherwise refactoring will not proceed. >+ >+PROGRAM UncontrolledDoLoop >+ REAL :: counter, sum >+ sum = 0.0 >+ counter = 1.2 >+ DO !<<<<< 8,3,8,5, 0, fail-final >+ sum = sum + counter >+ counter = counter + 0.1 >+ IF (counter > 1.8) THEN >+ EXIT >+ END IF >+ END DO >+ PRINT *, sum >+END PROGRAM UncontrolledDoLoop >Index: refactoring-test-code/remove-real-and-double-precision-loop-counters/uncontrolled-do-loop/uncontrolled-do-loop.result >=================================================================== >RCS file: refactoring-test-code/remove-real-and-double-precision-loop-counters/uncontrolled-do-loop/uncontrolled-do-loop.result >diff -N refactoring-test-code/remove-real-and-double-precision-loop-counters/uncontrolled-do-loop/uncontrolled-do-loop.result >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ refactoring-test-code/remove-real-and-double-precision-loop-counters/uncontrolled-do-loop/uncontrolled-do-loop.result 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,16 @@ >+! DO loop selected for refactoring must be a controlled >+! DO loop otherwise refactoring will not proceed. >+ >+PROGRAM UncontrolledDoLoop >+ REAL :: counter, sum >+ sum = 0.0 >+ counter = 1.2 >+ DO !<<<<< 8,3,8,5, 0, fail-final >+ sum = sum + counter >+ counter = counter + 0.1 >+ IF (counter > 1.8) THEN >+ EXIT >+ END IF >+ END DO >+ PRINT *, sum >+END PROGRAM UncontrolledDoLoop >Index: src/org/eclipse/photran/internal/tests/refactoring/RemoveBranchToEndIfTestSuite.java >=================================================================== >RCS file: src/org/eclipse/photran/internal/tests/refactoring/RemoveBranchToEndIfTestSuite.java >diff -N src/org/eclipse/photran/internal/tests/refactoring/RemoveBranchToEndIfTestSuite.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/photran/internal/tests/refactoring/RemoveBranchToEndIfTestSuite.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Rita Chow, Nicola Hall, Jerry Hsiao, Mark Mozolewski, Chamil Wijenayaka >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Rita Chow - Initial Implementation >+ * Nicola Hall - Initial Implementation >+ * Jerry Hsiao - Initial Implementation >+ * Mark Mozolewski - Initial Implementation >+ * Chamil Wijenayaka - Initial Implementation >+ *******************************************************************************/ >+package org.eclipse.photran.internal.tests.refactoring; >+ >+import junit.framework.Test; >+ >+import org.eclipse.photran.internal.core.refactoring.RemoveBranchToEndIfRefactoring; >+import org.eclipse.photran.internal.tests.Activator; >+import org.eclipse.photran.internal.tests.PhotranRefactoringTestSuiteFromMarkers; >+ >+/** >+ * Unit tests for the Remove Branch To End If Refactoring. >+ * >+ * @author Rita Chow (chow15), Jerry Hsiao (jhsiao2), Mark Mozolewski (mozolews), Chamil Wijenayaka >+ * (wijenay2), Nicola Hall (nfhall2) >+ */ >+public class RemoveBranchToEndIfTestSuite extends >+ PhotranRefactoringTestSuiteFromMarkers<RemoveBranchToEndIfRefactoring> >+{ >+ private static final String DIR = "refactoring-test-code/remove-branch-to-end-if"; >+ >+ public static Test suite() throws Exception >+ { >+ return new RemoveBranchToEndIfTestSuite(); >+ } >+ >+ public RemoveBranchToEndIfTestSuite() throws Exception >+ { >+ super(Activator.getDefault(), "Running Remove Branch To End If Refactoring in", DIR, >+ RemoveBranchToEndIfRefactoring.class); >+ } >+ >+} >Index: src/org/eclipse/photran/internal/tests/refactoring/RemovePauseStmtTestSuite.java >=================================================================== >RCS file: src/org/eclipse/photran/internal/tests/refactoring/RemovePauseStmtTestSuite.java >diff -N src/org/eclipse/photran/internal/tests/refactoring/RemovePauseStmtTestSuite.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/photran/internal/tests/refactoring/RemovePauseStmtTestSuite.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Rita Chow, Nicola Hall, Jerry Hsiao, Mark Mozolewski, Chamil Wijenayaka >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Rita Chow - Initial Implementation >+ * Nicola Hall - Initial Implementation >+ * Jerry Hsiao - Initial Implementation >+ * Mark Mozolewski - Initial Implementation >+ * Chamil Wijenayaka - Initial Implementation >+ *******************************************************************************/ >+package org.eclipse.photran.internal.tests.refactoring; >+ >+import junit.framework.Test; >+ >+import org.eclipse.photran.internal.core.refactoring.RemovePauseStmtRefactoring; >+import org.eclipse.photran.internal.tests.Activator; >+import org.eclipse.photran.internal.tests.PhotranRefactoringTestSuiteFromMarkers; >+ >+/** >+ * Unit tests for the Remove Pause Statement Refactoring. >+ * >+ * @author Rita Chow (chow15), Jerry Hsiao (jhsiao2), Mark Mozolewski (mozolews), Chamil Wijenayaka >+ * (wijenay2), Nicola Hall (nfhall2) >+ */ >+public class RemovePauseStmtTestSuite extends >+ PhotranRefactoringTestSuiteFromMarkers<RemovePauseStmtRefactoring> >+{ >+ private static final String DIR = "refactoring-test-code/remove-pause-stmt"; >+ >+ public static Test suite() throws Exception >+ { >+ return new RemovePauseStmtTestSuite(); >+ } >+ >+ public RemovePauseStmtTestSuite() throws Exception >+ { >+ super(Activator.getDefault(), "Running Remove Pause Stmt Refactoring in", DIR, >+ RemovePauseStmtRefactoring.class); >+ } >+ >+} >Index: src/org/eclipse/photran/internal/tests/refactoring/RemoveRealAndDoublePrecisionLoopCountersTestSuite.java >=================================================================== >RCS file: src/org/eclipse/photran/internal/tests/refactoring/RemoveRealAndDoublePrecisionLoopCountersTestSuite.java >diff -N src/org/eclipse/photran/internal/tests/refactoring/RemoveRealAndDoublePrecisionLoopCountersTestSuite.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/photran/internal/tests/refactoring/RemoveRealAndDoublePrecisionLoopCountersTestSuite.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,65 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Rita Chow, Nicola Hall, Jerry Hsiao, Mark Mozolewski, Chamil Wijenayaka >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Rita Chow - Initial Implementation >+ * Nicola Hall - Initial Implementation >+ * Jerry Hsiao - Initial Implementation >+ * Mark Mozolewski - Initial Implementation >+ * Chamil Wijenayaka - Initial Implementation >+ *******************************************************************************/ >+package org.eclipse.photran.internal.tests.refactoring; >+ >+import junit.framework.Test; >+ >+import org.eclipse.core.resources.IFile; >+import org.eclipse.jface.text.TextSelection; >+import org.eclipse.photran.internal.core.refactoring.RemoveRealAndDoublePrecisionLoopCountersRefactoring; >+import org.eclipse.photran.internal.tests.Activator; >+import org.eclipse.photran.internal.tests.PhotranRefactoringTestSuiteFromMarkers; >+ >+/** >+ * Unit tests for the Remove Branch To End If Refactoring. >+ * >+ * @author Rita Chow (chow15), Jerry Hsiao (jhsiao2), Mark Mozolewski (mozolews), Chamil Wijenayaka >+ * (wijenay2), Nicola Hall (nfhall2) >+ */ >+public class RemoveRealAndDoublePrecisionLoopCountersTestSuite extends >+ PhotranRefactoringTestSuiteFromMarkers<RemoveRealAndDoublePrecisionLoopCountersRefactoring> >+{ >+ private static final String DIR = "refactoring-test-code/remove-real-and-double-precision-loop-counters"; >+ >+ public static Test suite() throws Exception >+ { >+ return new RemoveRealAndDoublePrecisionLoopCountersTestSuite(); >+ } >+ >+ public RemoveRealAndDoublePrecisionLoopCountersTestSuite() throws Exception >+ { >+ super(Activator.getDefault(), >+ "Running Remove Real and Double Precision Loop Counters Refactoring in", DIR, >+ RemoveRealAndDoublePrecisionLoopCountersRefactoring.class); >+ } >+ >+ @Override >+ protected boolean configureRefactoring( >+ RemoveRealAndDoublePrecisionLoopCountersRefactoring refactoring, IFile file, >+ TextSelection selection, String[] markerText) >+ { >+ boolean shouldSucceed = super >+ .configureRefactoring(refactoring, file, selection, markerText); >+ >+ boolean shouldReplaceWithDoWhileLoop; >+ if (markerText[4].equals("1")) >+ shouldReplaceWithDoWhileLoop = true; >+ else >+ shouldReplaceWithDoWhileLoop = false; >+ refactoring.setShouldReplaceWithDoWhileLoop(shouldReplaceWithDoWhileLoop); >+ >+ return shouldSucceed; >+ } >+} >#P org.eclipse.photran.ui.vpg >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/photran/org.eclipse.photran.ui.vpg/plugin.xml,v >retrieving revision 1.78 >diff -u -r1.78 plugin.xml >--- plugin.xml 16 Nov 2010 18:07:25 -0000 1.78 >+++ plugin.xml 14 Dec 2010 05:47:39 -0000 >@@ -83,6 +83,16 @@ > <editorRefactoring > class="org.eclipse.photran.internal.core.refactoring.RemoveComputedGoToRefactoring" > /> >+ <editorRefactoring >+ class="org.eclipse.photran.internal.core.refactoring.RemoveBranchToEndIfRefactoring" >+ /> >+ <editorRefactoring >+ class="org.eclipse.photran.internal.core.refactoring.RemoveRealAndDoublePrecisionLoopCountersRefactoring" >+ inputPage="org.eclipse.photran.internal.ui.refactoring.RemoveRealAndDoublePrecisionLoopCountersInputPage" >+ /> >+ <editorRefactoring >+ class="org.eclipse.photran.internal.core.refactoring.RemovePauseStmtRefactoring" >+ /> > </group> > <group><!-- Refactorings for performance/loop transformations --> > <editorRefactoring >Index: src/org/eclipse/photran/internal/ui/refactoring/Messages.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/photran/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/refactoring/Messages.java,v >retrieving revision 1.3 >diff -u -r1.3 Messages.java >--- src/org/eclipse/photran/internal/ui/refactoring/Messages.java 21 Sep 2010 13:26:16 -0000 1.3 >+++ src/org/eclipse/photran/internal/ui/refactoring/Messages.java 14 Dec 2010 05:47:39 -0000 >@@ -7,6 +7,11 @@ > * > * Contributors: > * UIUC - Initial API and implementation >+ * Rita Chow - Photran Modifications >+ * Nicola Hall - Photran Modifications >+ * Jerry Hsiao - Photran Modifications >+ * Mark Mozolewski - Photran Modifications >+ * Chamil Wijenayaka - Photran Modifications > *******************************************************************************/ > package org.eclipse.photran.internal.ui.refactoring; > >@@ -84,6 +89,17 @@ > public static String RenameAction_MatchExternalSubprograms; > > public static String RenameAction_RenameAtoB; >+ >+ public static String RemoveRealAndDoublePrecisionLoopCountersInputPage_ReplaceRealDoublePrecisionLoopCounter; >+ >+ public static String RemoveRealAndDoublePrecisionLoopCountersInputPage_ReplaceWithDoLoop; >+ >+ public static String RemoveRealAndDoublePrecisionLoopCountersInputPage_ReplaceWithDoWhileLoop; >+ >+ public static String RemoveRealAndDoublePrecisionLoopCountersInputPage_ClickOKMessage; >+ >+ public static String RemoveRealAndDoublePrecisionLoopCountersInputPage_ClickPreviewMessage; >+ > static > { > // initialize resource bundle >Index: src/org/eclipse/photran/internal/ui/refactoring/RemoveRealAndDoublePrecisionLoopCountersInputPage.java >=================================================================== >RCS file: src/org/eclipse/photran/internal/ui/refactoring/RemoveRealAndDoublePrecisionLoopCountersInputPage.java >diff -N src/org/eclipse/photran/internal/ui/refactoring/RemoveRealAndDoublePrecisionLoopCountersInputPage.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/photran/internal/ui/refactoring/RemoveRealAndDoublePrecisionLoopCountersInputPage.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,82 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Rita Chow, Nicola Hall, Jerry Hsiao, Mark Mozolewski, Chamil Wijenayaka >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Rita Chow - Initial Implementation >+ * Nicola Hall - Initial Implementation >+ * Jerry Hsiao - Initial Implementation >+ * Mark Mozolewski - Initial Implementation >+ * Chamil Wijenayaka - Initial Implementation >+ *******************************************************************************/ >+package org.eclipse.photran.internal.ui.refactoring; >+ >+import org.eclipse.photran.internal.core.refactoring.RemoveRealAndDoublePrecisionLoopCountersRefactoring; >+import org.eclipse.rephraserengine.ui.refactoring.CustomUserInputPage; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.events.SelectionEvent; >+import org.eclipse.swt.events.SelectionListener; >+import org.eclipse.swt.layout.GridLayout; >+import org.eclipse.swt.widgets.Button; >+import org.eclipse.swt.widgets.Composite; >+import org.eclipse.swt.widgets.Label; >+ >+/** >+ * User input wizard page for the Change Keyword Case refactoring >+ * >+ * @author Rita Chow (chow15), Jerry Hsiao (jhsiao2), Mark Mozolewski (mozolews), Chamil Wijenayaka >+ * (wijenay2), Nicola Hall (nfhall2) >+ */ >+public class RemoveRealAndDoublePrecisionLoopCountersInputPage extends >+ CustomUserInputPage<RemoveRealAndDoublePrecisionLoopCountersRefactoring> >+{ >+ protected Button doWhileLoop; >+ >+ protected Button doLoop; >+ >+ @Override >+ public void createControl(Composite parent) >+ { >+ Composite top = new Composite(parent, SWT.NONE); >+ initializeDialogUnits(top); >+ setControl(top); >+ >+ top.setLayout(new GridLayout(1, false)); >+ >+ Composite group = top; >+ Label instr = new Label(group, SWT.NONE); >+ instr >+ .setText(Messages.RemoveRealAndDoublePrecisionLoopCountersInputPage_ReplaceRealDoublePrecisionLoopCounter); >+ >+ doWhileLoop = new Button(group, SWT.RADIO); >+ doWhileLoop >+ .setText(Messages.RemoveRealAndDoublePrecisionLoopCountersInputPage_ReplaceWithDoLoop); >+ doWhileLoop.setSelection(true); >+ doWhileLoop.addSelectionListener(new SelectionListener() >+ { >+ public void widgetDefaultSelected(SelectionEvent e) >+ { >+ widgetSelected(e); >+ } >+ >+ public void widgetSelected(SelectionEvent e) >+ { >+ boolean isChecked = doLoop.getSelection(); >+ getRefactoring().setShouldReplaceWithDoWhileLoop(isChecked); >+ } >+ }); >+ >+ doLoop = new Button(group, SWT.RADIO); >+ doLoop >+ .setText(Messages.RemoveRealAndDoublePrecisionLoopCountersInputPage_ReplaceWithDoWhileLoop); >+ >+ Label ok = new Label(group, SWT.NONE); >+ ok.setText("\n" + Messages.RemoveRealAndDoublePrecisionLoopCountersInputPage_ClickOKMessage); //$NON-NLS-1$ >+ Label preview = new Label(group, SWT.NONE); >+ preview >+ .setText(Messages.RemoveRealAndDoublePrecisionLoopCountersInputPage_ClickPreviewMessage); >+ } >+} >Index: src/org/eclipse/photran/internal/ui/refactoring/messages.properties >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.ptp/photran/org.eclipse.photran.ui.vpg/src/org/eclipse/photran/internal/ui/refactoring/messages.properties,v >retrieving revision 1.2 >diff -u -r1.2 messages.properties >--- src/org/eclipse/photran/internal/ui/refactoring/messages.properties 21 Sep 2010 13:26:16 -0000 1.2 >+++ src/org/eclipse/photran/internal/ui/refactoring/messages.properties 14 Dec 2010 05:47:40 -0000 >@@ -31,3 +31,8 @@ > MoveFromModuleInputPage_selectDataMessage=Please select member data to move from module > RenameAction_MatchExternalSubprograms=Match external subprograms with interfaces and external declarations > RenameAction_RenameAtoB=Rename {0} to >+RemoveRealAndDoublePrecisionLoopCountersInputPage_ReplaceRealDoublePrecisionLoopCounter=Replace real/double precision loop counter with: >+RemoveRealAndDoublePrecisionLoopCountersInputPage_ReplaceWithDoLoop=DO Loop >+RemoveRealAndDoublePrecisionLoopCountersInputPage_ReplaceWithDoWhileLoop=DO WHILE Loop >+RemoveRealAndDoublePrecisionLoopCountersInputPage_ClickOKMessage=Click OK to replace the real/double precision loop counter. >+RemoveRealAndDoublePrecisionLoopCountersInputPage_ClickPreviewMessage=To see what the changes will be made, click Preview.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
com-eclipse-dot-org
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 332492
:
185105
| 185107 |
185108