### Eclipse Workspace Patch 1.0 #P org.eclipse.photran.core.vpg Index: src/org/eclipse/photran/internal/core/refactoring/MakeSaveExplicitRefactoring.java =================================================================== RCS file: src/org/eclipse/photran/internal/core/refactoring/MakeSaveExplicitRefactoring.java diff -N src/org/eclipse/photran/internal/core/refactoring/MakeSaveExplicitRefactoring.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/photran/internal/core/refactoring/MakeSaveExplicitRefactoring.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,431 @@ +/******************************************************************************* + * Copyright (c) 2010 Stephen Downs, Robert Samblanet, Kevin Schilling, Jon + * Woolwine, and Chad Zamzow + * 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: + * Stephen Downs, Robert Samblanet, Kevin Schilling, + * Jon Woolwine, and Chad Zamzow + *******************************************************************************/ +package org.eclipse.photran.internal.core.refactoring; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.TreeSet; + +import org.eclipse.core.internal.resources.SavedState; +import org.eclipse.core.resources.IFile; +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.core.IFortranAST; +import org.eclipse.photran.internal.core.analysis.binding.ScopingNode; +import org.eclipse.photran.internal.core.lexer.Terminal; +import org.eclipse.photran.internal.core.lexer.Token; +import org.eclipse.photran.internal.core.parser.ASTAssignmentStmtNode; +import org.eclipse.photran.internal.core.parser.ASTAttrSpecNode; +import org.eclipse.photran.internal.core.parser.ASTAttrSpecSeqNode; +import org.eclipse.photran.internal.core.parser.ASTDatalistNode; +import org.eclipse.photran.internal.core.parser.ASTDataStmtNode; +import org.eclipse.photran.internal.core.parser.ASTEntityDeclNode; +import org.eclipse.photran.internal.core.parser.ASTListNode; +import org.eclipse.photran.internal.core.parser.ASTSaveStmtNode; +import org.eclipse.photran.internal.core.parser.ASTSavedEntityNode; +import org.eclipse.photran.internal.core.parser.ASTSeparatedListNode; +import org.eclipse.photran.internal.core.parser.ASTTypeDeclarationStmtNode; +import org.eclipse.photran.internal.core.parser.ASTVariableNode; +import org.eclipse.photran.internal.core.parser.ASTVisitor; +import org.eclipse.photran.internal.core.parser.IASTListNode; +import org.eclipse.photran.internal.core.parser.IASTNode; +import org.eclipse.photran.internal.core.refactoring.infrastructure.FortranResourceRefactoring; +import org.eclipse.photran.internal.core.refactoring.infrastructure.SourcePrinter; +import org.eclipse.photran.internal.core.reindenter.Reindenter; + +/** + * Makes all implicitly saved variables explicitly saved. + * + * @author Stephen Downs + * @author Robert Samblanet + * @author Kevin Schilling + * @author Jon Woolwine + * @author Chad Zamzow + */ +@SuppressWarnings("all") +public class MakeSaveExplicitRefactoring extends FortranResourceRefactoring +{ + /////////////////////////////////////////////////////////////////////////// + // Fields + /////////////////////////////////////////////////////////////////////////// + + @Override + public String getName() + { + return Messages.MakeSaveExplicitRefactoring_Name; + } + + private IFortranAST currAST = null; + + /////////////////////////////////////////////////////////////////////////// + // Initial Preconditions + /////////////////////////////////////////////////////////////////////////// + + /** + * @see MoveSavedToCommonBlockRefactoring + */ + @Override + protected void doCheckInitialConditions(RefactoringStatus status, IProgressMonitor pm) + throws PreconditionFailure + { + ensureProjectHasRefactoringEnabled(status); + } + + /////////////////////////////////////////////////////////////////////////// + // Final Preconditions + /////////////////////////////////////////////////////////////////////////// + + @Override + protected void doCheckFinalConditions(RefactoringStatus status, IProgressMonitor pm) throws PreconditionFailure{ + try + { + for (IFile file : selectedFiles) + { + IFortranAST ast = vpg.acquirePermanentAST(file); + if(ast == null) + { + status.addError(Messages.bind(Messages.MakeSaveExplicitRefactoring_SelectedFileCannotBeParsed, file.getName())); + } + else + { + currAST = ast; + makeChangesTo(file, status, pm); + vpg.releaseAST(file); + } + } + } + finally + { + vpg.releaseAllASTs(); + } + } + + /////////////////////////////////////////////////////////////////////////// + // Change + /////////////////////////////////////////////////////////////////////////// + + @Override + protected void doCreateChange(IProgressMonitor pm) throws CoreException, OperationCanceledException + { + + } + + /** + * Given an AST, makes the refactoring changes by calling the makeAllSaveAttributesExplicit function + * @param file + * @param status + * @param pm + * @throws PreconditionFailure + */ + private void makeChangesTo(IFile file, RefactoringStatus status, IProgressMonitor pm) throws PreconditionFailure + { + for (ScopingNode scope : currAST.getRoot().getAllContainedScopes()) + { + SavedVariableVisitor savedVariableVisitor = new SavedVariableVisitor(); + scope.accept(savedVariableVisitor); + if(!savedVariableVisitor.hasGlobalSaveStmt() && !scope.isMainProgram()) + { + HashSet explicitlySavedVariables = savedVariableVisitor.getExplicitlySavedVariables(); + TreeSet dataVariables = savedVariableVisitor.getDataBlockVariables(); + makeAllSaveAttributesExplicit(scope, explicitlySavedVariables, dataVariables); + } + } + addChangeFromModifiedAST(file, pm); + } + + /** + * Makes all implicit saves explicit in the given scope + * @param scope + * @param explicitlySavedVariables + * @param dataEntities + * @throws PreconditionFailure + */ + private void makeAllSaveAttributesExplicit(ScopingNode scope, HashSet explicitlySavedVariables, TreeSet dataEntities) + throws PreconditionFailure + { + if(scope.getBody() == null) + { + return; + } + + for (IASTNode node : scope.getBody().getChildren()) + { + if (node instanceof ASTTypeDeclarationStmtNode) + { + ASTTypeDeclarationStmtNode declarationNode = (ASTTypeDeclarationStmtNode)node; + makeImplicitlySavedVariablesExplicitlySaved(scope, declarationNode, dataEntities, explicitlySavedVariables); + } + } + + //add all implicitly saved data block variables to a save statement + for(String variable : dataEntities) + { + if(!explicitlySavedVariables.contains(variable.toLowerCase())) + { + addVariableToSaveStmt(scope, variable); + explicitlySavedVariables.add(variable.toLowerCase()); + } + } + } + + /** + * Helper function that adds SAVE to a type declaration + * @param scope + * @param typeDeclaration + * @param dataEntities + * @param savedEntities + */ + private void makeImplicitlySavedVariablesExplicitlySaved(ScopingNode scope, ASTTypeDeclarationStmtNode typeDeclaration, TreeSet dataEntities, HashSet savedEntities) + { + IASTListNode entityDeclList = typeDeclaration.getEntityDeclList(); + boolean declContainsSavedAndUnsavedVariables = containsUnsavedAndSavedVariables(typeDeclaration, dataEntities); + for(ASTEntityDeclNode variableDeclaration : entityDeclList) + { + if (isImplicitlySaved(scope, variableDeclaration, dataEntities) && + !savedEntities.contains(declarationVariableName(variableDeclaration).toLowerCase())) + { + if(!declContainsSavedAndUnsavedVariables) + { + String declString = SourcePrinter.getSourceCodeFromASTNode(typeDeclaration); + ASTAttrSpecSeqNode attrSpecSeqNode = createSaveAttrSpecSeqNode(!declString.contains("::")); + + // if there is no attrSpecSeq, create a new one and add it to the typeDeclaration + if( typeDeclaration.getAttrSpecSeq() == null ) + { + IASTListNode attrSpecSeq = new ASTListNode( 1 ); + typeDeclaration.setAttrSpecSeq(attrSpecSeq); + } + + // add Save attribute to attrSpecSeq + typeDeclaration.getAttrSpecSeq().add(attrSpecSeqNode); + + for(ASTEntityDeclNode decl : typeDeclaration.getEntityDeclList()) + { + savedEntities.add(declarationVariableName(decl).toLowerCase()); + } + + return; + } + else + { + String variableName = declarationVariableName(variableDeclaration); + savedEntities.add(variableName.toLowerCase()); + addVariableToSaveStmt(scope, variableName); + } + } + } + } + + /** + * Helper function that adds the given variable name to a global save statement in the given scope + * @param scope + * @param variableName + */ + private void addVariableToSaveStmt(ScopingNode scope, String variableName) + { + ASTSavedEntityNode savedEntity = new ASTSavedEntityNode(); + Token savedEntityToken = new Token(Terminal.T_IDENT, variableName); + savedEntity.setVariableName(savedEntityToken); + for (IASTNode node : scope.getBody().getChildren()) + { + if(node instanceof ASTSaveStmtNode) + { + IASTListNode variableList = ((ASTSaveStmtNode)node).getVariableList(); + ASTSeparatedListNode astSeparatedListNode = (ASTSeparatedListNode)variableList; + astSeparatedListNode.add(new Token(null, ", "), savedEntity); + return; + } + } + ASTSaveStmtNode newSaveStmt = (ASTSaveStmtNode)parseLiteralStatement("SAVE " + variableName); + IASTListNode body = scope.getBody(); + body.add(0, newSaveStmt); + Reindenter.reindent(newSaveStmt, currAST); + } + + /** + * Helper function that checks declaration lists to see if it contains both saved and unsaved variables + * @param typeDeclaration + * @param dataEntities + * @return + */ + private boolean containsUnsavedAndSavedVariables(ASTTypeDeclarationStmtNode typeDeclaration, TreeSet dataEntities) + { + if(typeDeclaration.getEntityDeclList() == null) return false; + boolean containsSaved = false, containsUnSaved = false; + + for(ASTEntityDeclNode decl : typeDeclaration.getEntityDeclList()) + { + if (decl.getInitialization() == null + && !dataEntities.contains(declarationVariableName(decl).toLowerCase())) + { + containsUnSaved = true; + } + else + { + containsSaved = true; + } + } + return containsSaved && containsUnSaved; + } + + /** + * Helper function that extracts the declaration variable name from a declaration node + * @param decl + * @return + */ + private String declarationVariableName(ASTEntityDeclNode decl) + { + return decl.getObjectName().getObjectName().getText(); + } + + /** + * Helper function that checks to see if a given variable is implicitly saved + * @param scope + * @param variableDeclaration + * @param dataEntities + * @return + */ + private boolean isImplicitlySaved(ScopingNode scope, ASTEntityDeclNode variableDeclaration, TreeSet dataEntities) + { + return (variableDeclaration.getInitialization() != null || + dataEntities.contains(declarationVariableName(variableDeclaration).toLowerCase())); + } + + /** + * Creates a new AttrSpecSeqNode with SAVE attribute + * @return new AttrSpecSeqNode with SAVE attribute + */ + private ASTAttrSpecSeqNode createSaveAttrSpecSeqNode(boolean addDblColon) + { + ASTAttrSpecSeqNode attrSpecSeqNode = new ASTAttrSpecSeqNode(); + ASTAttrSpecNode attrSpecNode = new ASTAttrSpecNode(); + + Token token; + if(addDblColon) + { + token = new Token(null, ", SAVE ::" ); + } + else + { + token = new Token(null, ", SAVE" ); + } + + attrSpecNode.setIsSave( token ); + attrSpecSeqNode.setAttrSpec(attrSpecNode); + return attrSpecSeqNode; + } + + /** + * Saved Variable Visitor class + * + * Iterates through all nodes in a scope. While doing this, it checks three different cases: + * 1) If the node is a save statement, it checks to see if it is a global save statement. + * If it isn't, it adds all the saved variables to the explicitlySavedVariables list. + * 2) If the node is a declaration, it checks to see if it has been explicitly saved. If it + * has, it adds the variable to the explicitlySavedVariables list. + * 3) If the node is a data statement, it adds all variables in the data block to the + * dataBlockVariables list. + * + * @author ShinSheep + */ + private class SavedVariableVisitor extends ASTVisitor + { + private boolean hasGlobalSaveStmt; + private HashSet explicitlySavedVariables; + private TreeSet dataBlockVariables; + private ASTSaveStmtNode saveStmt; + + public TreeSet getDataBlockVariables() + { + return dataBlockVariables; + } + + public HashSet getExplicitlySavedVariables() + { + return explicitlySavedVariables; + } + + public boolean hasGlobalSaveStmt() + { + return hasGlobalSaveStmt; + } + + public SavedVariableVisitor() + { + super(); + this.hasGlobalSaveStmt = false; + explicitlySavedVariables = new HashSet(); + dataBlockVariables = new TreeSet(); + saveStmt = null; + } + + @Override + public void visitASTSaveStmtNode(ASTSaveStmtNode node) + { + this.saveStmt = node; + if (node.getVariableList() == null) + { + hasGlobalSaveStmt = true; + } + else + { + for(ASTSavedEntityNode variable : node.getVariableList()) + { + explicitlySavedVariables.add(variable.getVariableName().getText().toLowerCase()); + } + } + } + + @Override + public void visitASTTypeDeclarationStmtNode(ASTTypeDeclarationStmtNode node) + { + IASTListNode attrSpecSeq = node.getAttrSpecSeq(); + if(attrSpecSeq != null) + { + for(ASTAttrSpecSeqNode attrSpecSeqNode : attrSpecSeq) + { + ASTAttrSpecNode attrSpecNode = attrSpecSeqNode.getAttrSpec(); + if(attrSpecNode != null && attrSpecNode.isSave()) + { + for(ASTEntityDeclNode variable : node.getEntityDeclList()) + { + explicitlySavedVariables.add(variable.getObjectName().getObjectName().getText().toLowerCase()); + } + } + } + } + } + + @Override + public void visitASTDataStmtNode(ASTDataStmtNode node) + { + IASTListNode dataList = ((ASTDataStmtNode)node).getDatalist(); + for (IASTNode dataEntity : dataList.getChildren()) + { + ASTDatalistNode dataListNode = (ASTDatalistNode)dataEntity; + for( IASTNode variableNameNode : dataListNode.getDataStmtSet().getDataStmtObjectList().getChildren()) + { + if(variableNameNode instanceof ASTVariableNode) + { + ASTVariableNode variableNode = (ASTVariableNode)variableNameNode; + String variableName = variableNode.getDataRef().get(0).getName().getText(); + + dataBlockVariables.add(variableName.toLowerCase()); + } + } + } + } + } +} \ No newline at end of file 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 15 Dec 2010 09:14:23 -0000 @@ -115,6 +115,10 @@ public static String ExtractProcedureRefactoring_ProcedureContainsLabels; public static String ExtractProcedureRefactoring_StatementCannotBeExtracted; + + public static String MakeSaveExplicitRefactoring_Name; + + public static String MakeSaveExplicitRefactoring_SelectedFileCannotBeParsed; public static String MinOnlyListRefactoring_ModuleIsEmpty; Index: src/org/eclipse/photran/internal/core/refactoring/messages.properties =================================================================== RCS file: /cvsroot/tools/org.eclipse.ptp/photran/org.eclipse.photran.core.vpg/src/org/eclipse/photran/internal/core/refactoring/messages.properties,v retrieving revision 1.13 diff -u -r1.13 messages.properties --- src/org/eclipse/photran/internal/core/refactoring/messages.properties 21 Sep 2010 15:31:10 -0000 1.13 +++ src/org/eclipse/photran/internal/core/refactoring/messages.properties 15 Dec 2010 09:14:23 -0000 @@ -120,6 +120,8 @@ MakePrivateEntityPublicRefactoring_NoPrivateEntitySelected=No private entities selected. MakePrivateEntityPublicRefactoring_PublicEntitySelectedSelectPrivate=Public entity is selected. Please select a Private entity. MakePrivateEntityPublicRefactoring_SelectPrivateEntityName=Please select a private entity name. +MakeSaveExplicitRefactoring_Name=Make Save Attributes Explicit +MakeSaveExplicitRefactoring_SelectedFileCannotBeParsed=One of the selected files ({0}) cannot be parsed. MinOnlyListRefactoring_ModuleIsEmpty=Module contains no declared entities. No ONLY clause is necessary. Please remove the ONLY clause from the USE statement. MinOnlyListRefactoring_ModuleNodeNotFound=Module AST node could not be found. MinOnlyListRefactoring_ModuleNotFoundWithName=No module with name {0} #P org.eclipse.photran.core.vpg.tests Index: refactoring-test-code/make-save-explicit/user-story-1/test-1.1/make_save_1_1.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-1/test-1.1/make_save_1_1.f90 diff -N refactoring-test-code/make-save-explicit/user-story-1/test-1.1/make_save_1_1.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-1/test-1.1/make_save_1_1.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +! USER STORY 1, TEST 1 +! Adds SAVE attribute to the initialized declaration statement for variable +! call_counter + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER :: call_counter = 0 + call_counter = call_counter + 1 + PRINT *, 'called:', call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-1/test-1.1/make_save_1_1.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-1/test-1.1/make_save_1_1.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-1/test-1.1/make_save_1_1.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-1/test-1.1/make_save_1_1.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +! USER STORY 1, TEST 1 +! Adds SAVE attribute to the initialized declaration statement for variable +! call_counter + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, SAVE :: call_counter = 0 + call_counter = call_counter + 1 + PRINT *, 'called:', call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-1/test-1.2/make_save_1_2.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-1/test-1.2/make_save_1_2.f90 diff -N refactoring-test-code/make-save-explicit/user-story-1/test-1.2/make_save_1_2.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-1/test-1.2/make_save_1_2.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,17 @@ +! USER STORY 1, TEST 2 +! Adds SAVE attribute to the initialized declaration statements for variables +! first_call_counter and second_call_counter + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER :: first_call_counter = 0 + INTEGER :: second_call_counter = 10 + first_call_counter = first_call_counter + 1 + second_call_counter = second_call_counter + 1 + PRINT *, 'called:', first_call_counter + PRINT *, 'called:', second_call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-1/test-1.2/make_save_1_2.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-1/test-1.2/make_save_1_2.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-1/test-1.2/make_save_1_2.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-1/test-1.2/make_save_1_2.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,17 @@ +! USER STORY 1, TEST 2 +! Adds SAVE attribute to the initialized declaration statements for variables +! first_call_counter and second_call_counter + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, SAVE :: first_call_counter = 0 + INTEGER, SAVE :: second_call_counter = 10 + first_call_counter = first_call_counter + 1 + second_call_counter = second_call_counter + 1 + PRINT *, 'called:', first_call_counter + PRINT *, 'called:', second_call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-1/test-1.3/make_save_1_3.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-1/test-1.3/make_save_1_3.f90 diff -N refactoring-test-code/make-save-explicit/user-story-1/test-1.3/make_save_1_3.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-1/test-1.3/make_save_1_3.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,21 @@ +! USER STORY 1, TEST 3 +! Adds SAVE attribute to the initialized declaration statement for variable +! first_call_counter, but not to the non-initialized declaration statement for +! variable second_call_counter + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER :: first_call_counter = 0 + INTEGER :: second_call_counter + second_call_counter = 10 + first_call_counter = first_call_counter + 1 + second_call_counter = second_call_counter + 1 + PRINT *, 'called:', first_call_counter + PRINT *, 'called:', second_call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-1/test-1.3/make_save_1_3.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-1/test-1.3/make_save_1_3.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-1/test-1.3/make_save_1_3.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-1/test-1.3/make_save_1_3.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,21 @@ +! USER STORY 1, TEST 3 +! Adds SAVE attribute to the initialized declaration statement for variable +! first_call_counter, but not to the non-initialized declaration statement for +! variable second_call_counter + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, SAVE :: first_call_counter = 0 + INTEGER :: second_call_counter + second_call_counter = 10 + first_call_counter = first_call_counter + 1 + second_call_counter = second_call_counter + 1 + PRINT *, 'called:', first_call_counter + PRINT *, 'called:', second_call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-1/test-1.4/make_save_1_4.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-1/test-1.4/make_save_1_4.f90 diff -N refactoring-test-code/make-save-explicit/user-story-1/test-1.4/make_save_1_4.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-1/test-1.4/make_save_1_4.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +! USER STORY 1, TEST 4 +! Adds SAVE attribute to the initialized declaration statement for array +! myArray + +PROGRAM MyProgram !<<<<< 11, 18, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, DIMENSION(3) :: myArray = (/ 1, 2, 3 /) + myArray(1) = myArray(1) + 1 + myArray(2) = myArray(2) + 2 + myArray(3) = myArray(3) + 3 + PRINT *, 'myArray:', myArray(1), myArray(2), myArray(3) +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-1/test-1.4/make_save_1_4.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-1/test-1.4/make_save_1_4.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-1/test-1.4/make_save_1_4.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-1/test-1.4/make_save_1_4.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +! USER STORY 1, TEST 4 +! Adds SAVE attribute to the initialized declaration statement for array +! myArray + +PROGRAM MyProgram !<<<<< 11, 18, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, DIMENSION(3), SAVE :: myArray = (/ 1, 2, 3 /) + myArray(1) = myArray(1) + 1 + myArray(2) = myArray(2) + 2 + myArray(3) = myArray(3) + 3 + PRINT *, 'myArray:', myArray(1), myArray(2), myArray(3) +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-2/test-2.1/make_save_2_1.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-2/test-2.1/make_save_2_1.f90 diff -N refactoring-test-code/make-save-explicit/user-story-2/test-2.1/make_save_2_1.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-2/test-2.1/make_save_2_1.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +! USER STORY 2, TEST 1 +! Does not add SAVE attribute to the initialized declaration statement for +! variable j due to the presence of the unspecified SAVE statement in the same +! subroutine + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE + INTEGER :: i + INTEGER :: j = 0 + i = i + 1 + j = j + 5 + PRINT *, 'i=', i, ', j=', j +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-2/test-2.1/make_save_2_1.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-2/test-2.1/make_save_2_1.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-2/test-2.1/make_save_2_1.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-2/test-2.1/make_save_2_1.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +! USER STORY 2, TEST 1 +! Does not add SAVE attribute to the initialized declaration statement for +! variable j due to the presence of the unspecified SAVE statement in the same +! subroutine + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE + INTEGER :: i + INTEGER :: j = 0 + i = i + 1 + j = j + 5 + PRINT *, 'i=', i, ', j=', j +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-2/test-2.2/make_save_2_2.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-2/test-2.2/make_save_2_2.f90 diff -N refactoring-test-code/make-save-explicit/user-story-2/test-2.2/make_save_2_2.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-2/test-2.2/make_save_2_2.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,29 @@ +! USER STORY 2, TEST 2 +! Does not add SAVE attribute to the initialized declaration statement for +! variable j due to the presence of the unspecified SAVE statement in the same +! subroutine, but does add SAVE attribute to the initialized declaration +! statement for variable n with no SAVE statement in the same subroutine + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySubOne + CALL MySubOne + CALL MySubTwo + CALL MySubTwo +END PROGRAM MyProgram + +SUBROUTINE MySubOne + SAVE + INTEGER :: i + INTEGER :: j = 0 + i = i + 1 + j = j + 5 + PRINT *, 'i=', i, ', j=', j +END SUBROUTINE MySub + +SUBROUTINE MySubTwo + INTEGER :: m + INTEGER :: n = 0 + m = m + 1 + n = n + 5 + PRINT *, 'm=', m, ', n=', n +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-2/test-2.2/make_save_2_2.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-2/test-2.2/make_save_2_2.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-2/test-2.2/make_save_2_2.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-2/test-2.2/make_save_2_2.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,29 @@ +! USER STORY 2, TEST 2 +! Does not add SAVE attribute to the initialized declaration statement for +! variable j due to the presence of the unspecified SAVE statement in the same +! subroutine, but does add SAVE attribute to the initialized declaration +! statement for variable n with no SAVE statement in the same subroutine + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySubOne + CALL MySubOne + CALL MySubTwo + CALL MySubTwo +END PROGRAM MyProgram + +SUBROUTINE MySubOne + SAVE + INTEGER :: i + INTEGER :: j = 0 + i = i + 1 + j = j + 5 + PRINT *, 'i=', i, ', j=', j +END SUBROUTINE MySub + +SUBROUTINE MySubTwo + INTEGER :: m + INTEGER, SAVE :: n = 0 + m = m + 1 + n = n + 5 + PRINT *, 'm=', m, ', n=', n +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-2/test-2.3/make_save_2_3.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-2/test-2.3/make_save_2_3.f90 diff -N refactoring-test-code/make-save-explicit/user-story-2/test-2.3/make_save_2_3.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-2/test-2.3/make_save_2_3.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,17 @@ +! USER STORY 2, TEST 3 +! Adds SAVE attribute to the initialized declaration statement for variable j +! with a SAVE statement for a different variable in the same subroutine + +PROGRAM MyProgram !<<<<< 7, 9, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE i + INTEGER :: i + INTEGER :: j = 0 + i = i + 1 + j = j + 5 + PRINT *, 'i=', i, ', j=', j +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-2/test-2.3/make_save_2_3.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-2/test-2.3/make_save_2_3.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-2/test-2.3/make_save_2_3.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-2/test-2.3/make_save_2_3.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,17 @@ +! USER STORY 2, TEST 3 +! Adds SAVE attribute to the initialized declaration statement for variable j +! with a SAVE statement for a different variable in the same subroutine + +PROGRAM MyProgram !<<<<< 7, 9, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE i + INTEGER :: i + INTEGER, SAVE :: j = 0 + i = i + 1 + j = j + 5 + PRINT *, 'i=', i, ', j=', j +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-3/test-3.1/make_save_3_1.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-3/test-3.1/make_save_3_1.f90 diff -N refactoring-test-code/make-save-explicit/user-story-3/test-3.1/make_save_3_1.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-3/test-3.1/make_save_3_1.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,17 @@ +! USER STORY 3, TEST 1 +! Adds SAVE attribute to the declaration statement for variable sum initialized +! through a DATA statement + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER :: sum + DATA sum /100/ + sum = sum + sum + PRINT *, 'sum=', sum +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-3/test-3.1/make_save_3_1.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-3/test-3.1/make_save_3_1.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-3/test-3.1/make_save_3_1.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-3/test-3.1/make_save_3_1.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,17 @@ +! USER STORY 3, TEST 1 +! Adds SAVE attribute to the declaration statement for variable sum initialized +! through a DATA statement + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, SAVE :: sum + DATA sum /100/ + sum = sum + sum + PRINT *, 'sum=', sum +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-3/test-3.2/make_save_3_2.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-3/test-3.2/make_save_3_2.f90 diff -N refactoring-test-code/make-save-explicit/user-story-3/test-3.2/make_save_3_2.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-3/test-3.2/make_save_3_2.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +! USER STORY 3, TEST 2 +! Adds SAVE attribute to the declaration statement for array myArray +! initialized through a DATA statement + +PROGRAM MyProgram !<<<<< 8,16, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, DIMENSION(2) :: myArray + DATA myArray /100, 10/ + myArray(1) = myArray(1) + 1 + myArray(2) = myArray(2) + 1 + PRINT *, 'myArray(1)=', myArray(1), 'myArray(2)=', myArray(2) +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-3/test-3.2/make_save_3_2.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-3/test-3.2/make_save_3_2.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-3/test-3.2/make_save_3_2.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-3/test-3.2/make_save_3_2.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +! USER STORY 3, TEST 2 +! Adds SAVE attribute to the declaration statement for array myArray +! initialized through a DATA statement + +PROGRAM MyProgram !<<<<< 8,16, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, DIMENSION(2), SAVE :: myArray + DATA myArray /100, 10/ + myArray(1) = myArray(1) + 1 + myArray(2) = myArray(2) + 1 + PRINT *, 'myArray(1)=', myArray(1), 'myArray(2)=', myArray(2) +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-4/test-4.1/make_save_4_1.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-4/test-4.1/make_save_4_1.f90 diff -N refactoring-test-code/make-save-explicit/user-story-4/test-4.1/make_save_4_1.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-4/test-4.1/make_save_4_1.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,17 @@ +! USER STORY 4, TEST 1 +! Adds SAVE attribute to the declaration statements for variables sumOne and +! sumTwo initialized through the same DATA statement + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER :: sumOne + INTEGER :: sumTwo + DATA sumOne /100/ sumTwo /10/ + sumOne = sumOne + sumOne + sumTwo = sumTwo + sumTwo + PRINT *, 'sumOne=', sumOne, 'sumTwo=', sumTwo +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-4/test-4.1/make_save_4_1.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-4/test-4.1/make_save_4_1.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-4/test-4.1/make_save_4_1.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-4/test-4.1/make_save_4_1.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,17 @@ +! USER STORY 4, TEST 1 +! Adds SAVE attribute to the declaration statements for variables sumOne and +! sumTwo initialized through the same DATA statement + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, SAVE :: sumOne + INTEGER, SAVE :: sumTwo + DATA sumOne /100/ sumTwo /10/ + sumOne = sumOne + sumOne + sumTwo = sumTwo + sumTwo + PRINT *, 'sumOne=', sumOne, 'sumTwo=', sumTwo +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-4/test-4.2/make_save_4_2.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-4/test-4.2/make_save_4_2.f90 diff -N refactoring-test-code/make-save-explicit/user-story-4/test-4.2/make_save_4_2.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-4/test-4.2/make_save_4_2.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,23 @@ +! USER STORY 4, TEST 2 +! Adds SAVE attribute to the declaration statements for arrays myArray and +! myArray2 initialized through the same DATA statement + +PROGRAM MyProgram !<<<<< 8,16, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, DIMENSION(2) :: myArray + INTEGER, DIMENSION(2) :: myArray2 + DATA myArray /10, 20/ myArray2 /30, 40/ + + myArray(1) = myArray(1) + 1 + myArray(2) = myArray(2) + 1 + + myArray2(1) = myArray2(1) + 1 + myArray2(2) = myArray2(2) + 1 + + PRINT *, 'myArray(1)=', myArray(1), 'myArray(2)=', myArray(2) + PRINT *, 'myArray2(1)=', myArray2(1), 'myArray2(2)=', myArray2(2) +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-4/test-4.2/make_save_4_2.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-4/test-4.2/make_save_4_2.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-4/test-4.2/make_save_4_2.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-4/test-4.2/make_save_4_2.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,23 @@ +! USER STORY 4, TEST 2 +! Adds SAVE attribute to the declaration statements for arrays myArray and +! myArray2 initialized through the same DATA statement + +PROGRAM MyProgram !<<<<< 8,16, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, DIMENSION(2), SAVE :: myArray + INTEGER, DIMENSION(2), SAVE :: myArray2 + DATA myArray /10, 20/ myArray2 /30, 40/ + + myArray(1) = myArray(1) + 1 + myArray(2) = myArray(2) + 1 + + myArray2(1) = myArray2(1) + 1 + myArray2(2) = myArray2(2) + 1 + + PRINT *, 'myArray(1)=', myArray(1), 'myArray(2)=', myArray(2) + PRINT *, 'myArray2(1)=', myArray2(1), 'myArray2(2)=', myArray2(2) +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-4/test-4.3/make_save_4_3.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-4/test-4.3/make_save_4_3.f90 diff -N refactoring-test-code/make-save-explicit/user-story-4/test-4.3/make_save_4_3.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-4/test-4.3/make_save_4_3.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,22 @@ +! USER STORY 4, TEST 3 +! Adds SAVE attribute to the declaration statements for variables i, j, and k +! initialized through the same DATA statement (alternate arrangement of DATA +! statement) + +PROGRAM MyProgram !<<<<< 8,16, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER :: i + INTEGER :: j + INTEGER :: k + DATA i,j,k /10, 20, 35/ + + i = i + 1 + j = j + 1 + k = k + 1 + + PRINT *, 'i=', i, 'j=', j, 'k=', k +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-4/test-4.3/make_save_4_3.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-4/test-4.3/make_save_4_3.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-4/test-4.3/make_save_4_3.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-4/test-4.3/make_save_4_3.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,22 @@ +! USER STORY 4, TEST 3 +! Adds SAVE attribute to the declaration statements for variables i, j, and k +! initialized through the same DATA statement (alternate arrangement of DATA +! statement) + +PROGRAM MyProgram !<<<<< 8,16, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, SAVE :: i + INTEGER, SAVE :: j + INTEGER, SAVE :: k + DATA i,j,k /10, 20, 35/ + + i = i + 1 + j = j + 1 + k = k + 1 + + PRINT *, 'i=', i, 'j=', j, 'k=', k +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-4/test-4.4/make_save_4_4.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-4/test-4.4/make_save_4_4.f90 diff -N refactoring-test-code/make-save-explicit/user-story-4/test-4.4/make_save_4_4.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-4/test-4.4/make_save_4_4.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +! USER STORY 4, TEST 4 +! Adds SAVE attribute to the declaration statements for variables sum1 and sum2 +! initialized through the same DATA statement (alternate arrangement of DATA +! statement) + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER :: sum1, sum2 + DATA sum1, sum2 /100, 200/ + sum1 = sum1 + sum1 + sum2 = sum2 + sum2 !<<<<< 1,11, pass + PRINT *, 'sum1=', sum1 + PRINT *, 'sum2=', sum2 +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-4/test-4.4/make_save_4_4.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-4/test-4.4/make_save_4_4.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-4/test-4.4/make_save_4_4.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-4/test-4.4/make_save_4_4.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +! USER STORY 4, TEST 4 +! Adds SAVE attribute to the declaration statements for variables sum1 and sum2 +! initialized through the same DATA statement (alternate arrangement of DATA +! statement) + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, SAVE :: sum1, sum2 + DATA sum1, sum2 /100, 200/ + sum1 = sum1 + sum1 + sum2 = sum2 + sum2 !<<<<< 1,11, pass + PRINT *, 'sum1=', sum1 + PRINT *, 'sum2=', sum2 +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-4/test-4.5/make_save_4_5.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-4/test-4.5/make_save_4_5.f90 diff -N refactoring-test-code/make-save-explicit/user-story-4/test-4.5/make_save_4_5.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-4/test-4.5/make_save_4_5.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,19 @@ +! USER STORY 4, TEST 5 +! Adds SAVE attribute to the declaration statements for variables sum1 and sum2 +! initialized through the same DATA statement + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram + CALL MySub + CALL MySub +END PROGRAM MyProgram + !<<<<< 1,1, pass +SUBROUTINE MySub + INTEGER :: sum1, sum2 + DATA sum1 /100/, sum2 /200/ + sum1 = sum1 + sum1 + sum2 = sum2 + sum2 + PRINT *, 'sum1=', sum1 + PRINT *, 'sum2=', sum2 +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-4/test-4.5/make_save_4_5.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-4/test-4.5/make_save_4_5.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-4/test-4.5/make_save_4_5.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-4/test-4.5/make_save_4_5.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,19 @@ +! USER STORY 4, TEST 5 +! Adds SAVE attribute to the declaration statements for variables sum1 and sum2 +! initialized through the same DATA statement + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram + CALL MySub + CALL MySub +END PROGRAM MyProgram + !<<<<< 1,1, pass +SUBROUTINE MySub + INTEGER, SAVE :: sum1, sum2 + DATA sum1 /100/, sum2 /200/ + sum1 = sum1 + sum1 + sum2 = sum2 + sum2 + PRINT *, 'sum1=', sum1 + PRINT *, 'sum2=', sum2 +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-5/test-5.1/make_save_5_1.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-5/test-5.1/make_save_5_1.f90 diff -N refactoring-test-code/make-save-explicit/user-story-5/test-5.1/make_save_5_1.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-5/test-5.1/make_save_5_1.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,19 @@ +! USER STORY 5, TEST 1 +! Adds SAVE statement for variables sum1 and sum2 due to variables not +! having declaration statements while being initialized by a DATA statement + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + DATA sum1, sum2 /100, 200/ + sum1 = sum1 + sum1 + sum2 = sum2 + sum2 + PRINT *, 'sum1=', sum1 + PRINT *, 'sum2=', sum2 +END SUBROUTINE MySub +!<<<<< 1,1, pass Index: refactoring-test-code/make-save-explicit/user-story-5/test-5.1/make_save_5_1.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-5/test-5.1/make_save_5_1.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-5/test-5.1/make_save_5_1.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-5/test-5.1/make_save_5_1.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +! USER STORY 5, TEST 1 +! Adds SAVE statement for variables sum1 and sum2 due to variables not +! having declaration statements while being initialized by a DATA statement + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE sum1, sum2 + DATA sum1, sum2 /100, 200/ + sum1 = sum1 + sum1 + sum2 = sum2 + sum2 + PRINT *, 'sum1=', sum1 + PRINT *, 'sum2=', sum2 +END SUBROUTINE MySub +!<<<<< 1,1, pass Index: refactoring-test-code/make-save-explicit/user-story-5/test-5.2/make_save_5_2.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-5/test-5.2/make_save_5_2.f90 diff -N refactoring-test-code/make-save-explicit/user-story-5/test-5.2/make_save_5_2.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-5/test-5.2/make_save_5_2.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,19 @@ +! USER STORY 5, TEST 2 +! Adds variable sum2 to a previously existing SAVE statement due to variable not +! having a declaration statement while being initialized by a DATA statement + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram !<<<<< 1,1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + DATA sum1, sum2 /100, 200/ + SAVE sum1 + sum1 = sum1 + sum1 + sum2 = sum2 + sum2 + PRINT *, 'sum1=', sum1 + PRINT *, 'sum2=', sum2 +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-5/test-5.2/make_save_5_2.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-5/test-5.2/make_save_5_2.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-5/test-5.2/make_save_5_2.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-5/test-5.2/make_save_5_2.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,19 @@ +! USER STORY 5, TEST 2 +! Adds variable sum2 to a previously existing SAVE statement due to variable not +! having a declaration statement while being initialized by a DATA statement + +! EXAMPLE FROM USER STORY + +PROGRAM MyProgram !<<<<< 1,1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + DATA sum1, sum2 /100, 200/ + SAVE sum1, sum2 + sum1 = sum1 + sum1 + sum2 = sum2 + sum2 + PRINT *, 'sum1=', sum1 + PRINT *, 'sum2=', sum2 +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-5/test-5.3/make_save_5_3.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-5/test-5.3/make_save_5_3.f90 diff -N refactoring-test-code/make-save-explicit/user-story-5/test-5.3/make_save_5_3.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-5/test-5.3/make_save_5_3.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +! USER STORY 5, TEST 3 +! Adds SAVE statement for variable i due to variable not having declaration +! statement while being initialized by a DATA statement (variable unused, +! otherwise), but does not add SAVE statement for variable j due to variable +! having neither a declaration statement nor a DATA statement for its +! initialization + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + DATA i /0/ + j = 0 +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-5/test-5.3/make_save_5_3.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-5/test-5.3/make_save_5_3.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-5/test-5.3/make_save_5_3.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-5/test-5.3/make_save_5_3.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,17 @@ +! USER STORY 5, TEST 3 +! Adds SAVE statement for variable i due to variable not having declaration +! statement while being initialized by a DATA statement (variable unused, +! otherwise), but does not add SAVE statement for variable j due to variable +! having neither a declaration statement nor a DATA statement for its +! initialization + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE i + DATA i /0/ + j = 0 +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-5/test-5.4/make_save_5_4.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-5/test-5.4/make_save_5_4.f90 diff -N refactoring-test-code/make-save-explicit/user-story-5/test-5.4/make_save_5_4.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-5/test-5.4/make_save_5_4.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,15 @@ +! USER STORY 5, TEST 4 +! Does not add variable i to existing SAVE statement due to variable names +! being case-insensitive, meaning that variable i is already explicitly saved +! due to the existing SAVE statement + + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE I + DATA i /0/ +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-5/test-5.4/make_save_5_4.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-5/test-5.4/make_save_5_4.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-5/test-5.4/make_save_5_4.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-5/test-5.4/make_save_5_4.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,15 @@ +! USER STORY 5, TEST 4 +! Does not add variable i to existing SAVE statement due to variable names +! being case-insensitive, meaning that variable i is already explicitly saved +! due to the existing SAVE statement + + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE I + DATA i /0/ +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-6/test-6.1/make_save_6_1.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-6/test-6.1/make_save_6_1.f90 diff -N refactoring-test-code/make-save-explicit/user-story-6/test-6.1/make_save_6_1.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-6/test-6.1/make_save_6_1.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,15 @@ +! USER STORY 6, TEST 1 +! Adds SAVE statement for variable call_counter due to variable being +! initialized in its declaration statement while sharing the same declaration +! statement with non-initialized variable other_var + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER :: call_counter = 0, other_var + call_counter = call_counter + 1 + PRINT *, 'called:', call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-6/test-6.1/make_save_6_1.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-6/test-6.1/make_save_6_1.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-6/test-6.1/make_save_6_1.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-6/test-6.1/make_save_6_1.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +! USER STORY 6, TEST 1 +! Adds SAVE statement for variable call_counter due to variable being +! initialized in its declaration statement while sharing the same declaration +! statement with non-initialized variable other_var + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE call_counter + INTEGER :: call_counter = 0, other_var + call_counter = call_counter + 1 + PRINT *, 'called:', call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-6/test-6.2/make_save_6_2.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-6/test-6.2/make_save_6_2.f90 diff -N refactoring-test-code/make-save-explicit/user-story-6/test-6.2/make_save_6_2.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-6/test-6.2/make_save_6_2.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,17 @@ +! USER STORY 6, TEST 2 +! Adds variable call_counter to a previously existing SAVE statement due to +! variable being initialized in its declaration statement while sharing the +! same declaration statement with non-initialized variable other_var + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE third_var + INTEGER :: call_counter = 0, other_var + INTEGER :: third_var + call_counter = call_counter + 1 + PRINT *, 'called:', call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-6/test-6.2/make_save_6_2.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-6/test-6.2/make_save_6_2.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-6/test-6.2/make_save_6_2.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-6/test-6.2/make_save_6_2.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,17 @@ +! USER STORY 6, TEST 2 +! Adds variable call_counter to a previously existing SAVE statement due to +! variable being initialized in its declaration statement while sharing the +! same declaration statement with non-initialized variable other_var + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE third_var, call_counter + INTEGER :: call_counter = 0, other_var + INTEGER :: third_var + call_counter = call_counter + 1 + PRINT *, 'called:', call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-6/test-6.3/make_save_6_3.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-6/test-6.3/make_save_6_3.f90 diff -N refactoring-test-code/make-save-explicit/user-story-6/test-6.3/make_save_6_3.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-6/test-6.3/make_save_6_3.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,18 @@ +! USER STORY 6, TEST 3 +! Adds SAVE attribute to the declaration statement for variables +! first_call_counter and second_call_counter since both variables are +! implicitly saved by some means + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER :: first_call_counter = 0, second_call_counter + DATA second_call_counter /10/ + first_call_counter = first_call_counter + 1 + second_call_counter = second_call_counter + 1 + PRINT *, 'called:', first_call_counter + PRINT *, 'called:', second_call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-6/test-6.3/make_save_6_3.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-6/test-6.3/make_save_6_3.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-6/test-6.3/make_save_6_3.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-6/test-6.3/make_save_6_3.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,18 @@ +! USER STORY 6, TEST 3 +! Adds SAVE attribute to the declaration statement for variables +! first_call_counter and second_call_counter since both variables are +! implicitly saved by some means + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, SAVE :: first_call_counter = 0, second_call_counter + DATA second_call_counter /10/ + first_call_counter = first_call_counter + 1 + second_call_counter = second_call_counter + 1 + PRINT *, 'called:', first_call_counter + PRINT *, 'called:', second_call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-6/test-6.4/make_save_6_4.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-6/test-6.4/make_save_6_4.f90 diff -N refactoring-test-code/make-save-explicit/user-story-6/test-6.4/make_save_6_4.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-6/test-6.4/make_save_6_4.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,18 @@ +! USER STORY 6, TEST 4 +! Adds SAVE statement for variables first_call_counter and second_call_counter +! since both variables are implicitly saved by some means while sharing the +! same declaration statement with a variable that is not implicitly saved + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER :: first_call_counter = 0, second_call_counter, other_var + DATA second_call_counter /10/ + first_call_counter = first_call_counter + 1 + second_call_counter = second_call_counter + 1 + PRINT *, 'called:', first_call_counter + PRINT *, 'called:', second_call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-6/test-6.4/make_save_6_4.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-6/test-6.4/make_save_6_4.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-6/test-6.4/make_save_6_4.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-6/test-6.4/make_save_6_4.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,19 @@ +! USER STORY 6, TEST 4 +! Adds SAVE statement for variables first_call_counter and second_call_counter +! since both variables are implicitly saved by some means while sharing the +! same declaration statement with a variable that is not implicitly saved + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE first_call_counter, second_call_counter + INTEGER :: first_call_counter = 0, second_call_counter, other_var + DATA second_call_counter /10/ + first_call_counter = first_call_counter + 1 + second_call_counter = second_call_counter + 1 + PRINT *, 'called:', first_call_counter + PRINT *, 'called:', second_call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-6/test-6.5/make_save_6_5.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-6/test-6.5/make_save_6_5.f90 diff -N refactoring-test-code/make-save-explicit/user-story-6/test-6.5/make_save_6_5.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-6/test-6.5/make_save_6_5.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +! USER STORY 6, TEST 5 +! Adds variable call_counter to SAVE statement for variable other_var due to +! call_counter being initialized in its declaration statement while sharing the +! same declaration statement with explicitly-saved variable other_var + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE other_var + INTEGER :: other_var, call_counter = 0 + call_counter = call_counter + 1 + PRINT *, 'called:', call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-6/test-6.5/make_save_6_5.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-6/test-6.5/make_save_6_5.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-6/test-6.5/make_save_6_5.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-6/test-6.5/make_save_6_5.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,16 @@ +! USER STORY 6, TEST 5 +! Adds variable call_counter to SAVE statement for variable other_var due to +! call_counter being initialized in its declaration statement while sharing the +! same declaration statement with explicitly-saved variable other_var + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE other_var, call_counter + INTEGER :: other_var, call_counter = 0 + call_counter = call_counter + 1 + PRINT *, 'called:', call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-7/test-7.1/make_save_7_1.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-7/test-7.1/make_save_7_1.f90 diff -N refactoring-test-code/make-save-explicit/user-story-7/test-7.1/make_save_7_1.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-7/test-7.1/make_save_7_1.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,14 @@ +! USER STORY 7, TEST 1 +! Adds SAVE statement for variable call_counter due to variable being +! initialized in its declaration statement without :: operator + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER call_counter = 0 + call_counter = call_counter + 1 + PRINT *, 'called:', call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-7/test-7.1/make_save_7_1.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-7/test-7.1/make_save_7_1.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-7/test-7.1/make_save_7_1.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-7/test-7.1/make_save_7_1.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,14 @@ +! USER STORY 7, TEST 1 +! Adds SAVE statement for variable call_counter due to variable being +! initialized in its declaration statement without :: operator + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, SAVE :: call_counter = 0 + call_counter = call_counter + 1 + PRINT *, 'called:', call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-7/test-7.2/make_save_7_2.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-7/test-7.2/make_save_7_2.f90 diff -N refactoring-test-code/make-save-explicit/user-story-7/test-7.2/make_save_7_2.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-7/test-7.2/make_save_7_2.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,15 @@ +! USER STORY 7, TEST 1 +! Adds SAVE statement for variable call_counter due to variable being +! implicitly saved in a data block + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER call_counter + data call_counter /10/ + call_counter = call_counter + 1 + PRINT *, 'called:', call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-7/test-7.2/make_save_7_2.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-7/test-7.2/make_save_7_2.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-7/test-7.2/make_save_7_2.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-7/test-7.2/make_save_7_2.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,15 @@ +! USER STORY 7, TEST 1 +! Adds SAVE statement for variable call_counter due to variable being +! implicitly saved in a data block + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, SAVE :: call_counter + data call_counter /10/ + call_counter = call_counter + 1 + PRINT *, 'called:', call_counter +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-7/test-7.3/make_save_7_3.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-7/test-7.3/make_save_7_3.f90 diff -N refactoring-test-code/make-save-explicit/user-story-7/test-7.3/make_save_7_3.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-7/test-7.3/make_save_7_3.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,15 @@ +! USER STORY 7, TEST 1 +! Adds SAVE statement for variable call_counter and call_counter2 +! due to variables being implicitly saved + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER call_counter = 10, call_counter2 = 20 + call_counter = call_counter + 1 + call_counter2 = call_counter2 + 2 + PRINT *, 'called:', call_counter, call_counter2 +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-7/test-7.3/make_save_7_3.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-7/test-7.3/make_save_7_3.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-7/test-7.3/make_save_7_3.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-7/test-7.3/make_save_7_3.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,15 @@ +! USER STORY 7, TEST 1 +! Adds SAVE statement for variable call_counter and call_counter2 +! due to variables being implicitly saved + +PROGRAM MyProgram !<<<<< 1, 1, pass + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, SAVE :: call_counter = 10, call_counter2 = 20 + call_counter = call_counter + 1 + call_counter2 = call_counter2 + 2 + PRINT *, 'called:', call_counter, call_counter2 +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-8/test-8.1/make_save_8_1.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-8/test-8.1/make_save_8_1.f90 diff -N refactoring-test-code/make-save-explicit/user-story-8/test-8.1/make_save_8_1.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-8/test-8.1/make_save_8_1.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +! USER STORY 8, TEST 1 +! Adds SAVE attribute to the initialized declaration statement for variable j +! in subroutine MySub, but not to the initialized declaration statement for +! variable i in program MyProgram + +PROGRAM MyProgram !<<<<< 1, 1, pass + INTEGER :: i = 0 + i = i + 1 + PRINT *, 'called:', i + i = i + 1 + PRINT *, 'called:', i + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER :: j = 10 + j = j + 1 + PRINT *, 'called:', j +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-8/test-8.1/make_save_8_1.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-8/test-8.1/make_save_8_1.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-8/test-8.1/make_save_8_1.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-8/test-8.1/make_save_8_1.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,20 @@ +! USER STORY 8, TEST 1 +! Adds SAVE attribute to the initialized declaration statement for variable j +! in subroutine MySub, but not to the initialized declaration statement for +! variable i in program MyProgram + +PROGRAM MyProgram !<<<<< 1, 1, pass + INTEGER :: i = 0 + i = i + 1 + PRINT *, 'called:', i + i = i + 1 + PRINT *, 'called:', i + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, SAVE :: j = 10 + j = j + 1 + PRINT *, 'called:', j +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-8/test-8.2/make_save_8_2.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-8/test-8.2/make_save_8_2.f90 diff -N refactoring-test-code/make-save-explicit/user-story-8/test-8.2/make_save_8_2.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-8/test-8.2/make_save_8_2.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,23 @@ +! USER STORY 8, TEST 2 +! Adds SAVE attribute to the declaration statement for variable j initialized +! through a DATA statement in subroutine MySub, but not to the declaration +! statement for variable i also initialized through a DATA statement in program +! MyProgram + +PROGRAM MyProgram !<<<<< 1, 1, pass + INTEGER :: i + DATA i /0/ + i = i + 1 + PRINT *, 'called:', i + i = i + 1 + PRINT *, 'called:', i + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER :: j + DATA j /0/ + j = j + 1 + PRINT *, 'called:', j +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-8/test-8.2/make_save_8_2.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-8/test-8.2/make_save_8_2.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-8/test-8.2/make_save_8_2.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-8/test-8.2/make_save_8_2.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,23 @@ +! USER STORY 8, TEST 2 +! Adds SAVE attribute to the declaration statement for variable j initialized +! through a DATA statement in subroutine MySub, but not to the declaration +! statement for variable i also initialized through a DATA statement in program +! MyProgram + +PROGRAM MyProgram !<<<<< 1, 1, pass + INTEGER :: i + DATA i /0/ + i = i + 1 + PRINT *, 'called:', i + i = i + 1 + PRINT *, 'called:', i + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + INTEGER, SAVE :: j + DATA j /0/ + j = j + 1 + PRINT *, 'called:', j +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-8/test-8.3/make_save_8_3.f90 =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-8/test-8.3/make_save_8_3.f90 diff -N refactoring-test-code/make-save-explicit/user-story-8/test-8.3/make_save_8_3.f90 --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-8/test-8.3/make_save_8_3.f90 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,21 @@ +! USER STORY 8, TEST 3 +! Adds SAVE statement for variables j due to variable not having declaration +! statement while being initialized by a DATA statement in subroutine MySub, +! but doesn't add it for variables i due to variable not having declaration +! statement while being initialized by a DATA statement in program MyProgram + +PROGRAM MyProgram !<<<<< 1, 1, pass + DATA i /0/ + i = i + 1 + PRINT *, 'called:', i + i = i + 1 + PRINT *, 'called:', i + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + DATA j /0/ + j = j + 1 + PRINT *, 'called:', j +END SUBROUTINE MySub Index: refactoring-test-code/make-save-explicit/user-story-8/test-8.3/make_save_8_3.f90.result =================================================================== RCS file: refactoring-test-code/make-save-explicit/user-story-8/test-8.3/make_save_8_3.f90.result diff -N refactoring-test-code/make-save-explicit/user-story-8/test-8.3/make_save_8_3.f90.result --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ refactoring-test-code/make-save-explicit/user-story-8/test-8.3/make_save_8_3.f90.result 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,22 @@ +! USER STORY 8, TEST 3 +! Adds SAVE statement for variables j due to variable not having declaration +! statement while being initialized by a DATA statement in subroutine MySub, +! but doesn't add it for variables i due to variable not having declaration +! statement while being initialized by a DATA statement in program MyProgram + +PROGRAM MyProgram !<<<<< 1, 1, pass + DATA i /0/ + i = i + 1 + PRINT *, 'called:', i + i = i + 1 + PRINT *, 'called:', i + CALL MySub + CALL MySub +END PROGRAM MyProgram + +SUBROUTINE MySub + SAVE j + DATA j /0/ + j = j + 1 + PRINT *, 'called:', j +END SUBROUTINE MySub Index: src/org/eclipse/photran/internal/tests/refactoring/MakeSaveExplicitTestSuite.java =================================================================== RCS file: src/org/eclipse/photran/internal/tests/refactoring/MakeSaveExplicitTestSuite.java diff -N src/org/eclipse/photran/internal/tests/refactoring/MakeSaveExplicitTestSuite.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ src/org/eclipse/photran/internal/tests/refactoring/MakeSaveExplicitTestSuite.java 1 Jan 1970 00:00:00 -0000 @@ -0,0 +1,48 @@ +/******************************************************************************* + * Copyright (c) 2010 Stephen Downs, Robert Samblanet, Kevin Schilling, Jon + * Woolwine, and Chad Zamzow + * 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: + * Stephen Downs, Robert Samblanet, Kevin Schilling, + * Jon Woolwine, and Chad Zamzow + *******************************************************************************/ + +package org.eclipse.photran.internal.tests.refactoring; + +import junit.framework.Test; + +import org.eclipse.photran.internal.core.refactoring.MakeSaveExplicitRefactoring; +import org.eclipse.photran.internal.tests.Activator; +import org.eclipse.photran.internal.tests.PhotranRefactoringTestSuiteFromMarkers; + +/** + * Unit tests for the Make Save Explicit refactoring. + * + * @author Stephen Downs + * @author Robert Samblanet + * @author Kevin Schilling + * @author Jon Woolwine + * @author Chad Zamzow + */ +public class MakeSaveExplicitTestSuite + extends PhotranRefactoringTestSuiteFromMarkers +{ + private static final String DIR = "refactoring-test-code/make-save-explicit"; + + public static Test suite() throws Exception + { + return new MakeSaveExplicitTestSuite(); + } + + public MakeSaveExplicitTestSuite() throws Exception + { + super(Activator.getDefault(), + "Running Make Save Attribute Explicit refactoring in", + DIR, + MakeSaveExplicitRefactoring.class); + } +} \ No newline at end of file #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 15 Dec 2010 09:14:24 -0000 @@ -29,6 +29,9 @@ class="org.eclipse.photran.internal.core.refactoring.DataToParameterRefactoring" /> +