Changes between Initial Version and Version 1 of RefactoringSteps/RenameHeader


Ignore:
Timestamp:
Feb 17, 2012, 4:58:16 PM (13 years ago)
Author:
manualwiki
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RefactoringSteps/RenameHeader

    v1 v1  
     1= Rename header = 
     2 
     3The rename header refactoring renames the header file to the given new name, and makes changes in those files in which it is referred to. If the new name of the header file contains a path and this path is not equal to the original one, the transformation moves the header file to its new place and renames it. In the example the {{{header1.hrl}}} is renamed to {{{newname}}}. The file and all of its references are also renamed to {{{newname}}}. 
     4 
     5Renaming header file {{{header1.hrl}}} to {{{newname}}}: 
     6 
     7{{{ 
     8%%header1.hrl 
     9 
     10-define(MacroFromHeader, 
     11                    ok). 
     12 
     13-define(Add(X, Y), 
     14           X + Y).                                  
     15}}} 
     16 
     17{{{ 
     18-module(refmod1). 
     19-include("header1.hrl"). 
     20 
     21-export([func1/2,func2/2]). 
     22 
     23func1(A, B) -> 
     24   ?Add(A, B). 
     25 
     26func2() -> 
     27   ?MacroFromHeader. 
     28}}} 
     29 
     30Result: 
     31 
     32{{{ 
     33%%newname 
     34 
     35-define(MacroFromHeader, 
     36                    ok). 
     37 
     38-define(Add(X, Y), 
     39           X + Y).                                  
     40}}} 
     41 
     42{{{ 
     43-module(refmod1). 
     44-include("newname"). 
     45 
     46-export([func1/2,func2/2]). 
     47 
     48func1(A, B) -> 
     49   ?Add(A, B). 
     50 
     51func2() -> 
     52   ?MacroFromHeader. 
     53}}} 
     54 
     55== Side conditions == 
     56 
     57 * The type of the file has to be a header file. If the pointed file is a module, the transformation will fail. 
     58 
     59 * The directory must not contain a file having the same name as new name given. If it contains, the transformation starts an interaction to ask for a new name. 
     60 
     61== Transformation steps and compensations == 
     62 
     63 1. Rename the header file name to the new name on the graph. 
     64 
     65 2. Rename the references to the header file in the include forms. (Actually, the include form will be deleted and recreated with a new path and file name). 
     66 
     67 3. Rename or move and rename the file to the new name.