Changes between Initial Version and Version 1 of RefactoringSteps/RenameMacro


Ignore:
Timestamp:
Feb 15, 2012, 7:25:44 PM (13 years ago)
Author:
manualwiki
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • RefactoringSteps/RenameMacro

    v1 v1  
     1= Rename macro = 
     2 
     3The "rename macro" transformation renames a macro and all of its occurrences in either modules and header files. The condition of the renaming is that there is no name conflict with another record in the file containing the macro, in any of its includes or anywhere it has been included at. 
     4 
     5Renaming macro {{{LessEq}}} to {{{Leq}}}: 
     6 
     7{{{ 
     8-define(LessEq, =<). 
     9 
     10max(X,Z) -> 
     11   if 
     12      X ?LessEq Z -> Z; 
     13      X>=Z -> X 
     14   end. 
     15}}} 
     16 
     17Result: 
     18 
     19{{{ 
     20-define(Leq, =<). 
     21 
     22max(Y,Z) -> 
     23   if 
     24      Y ?Leq Z -> Z; 
     25      Y>=Z -> Y 
     26   end. 
     27}}} 
     28 
     29== Side conditions == 
     30 
     31 * No macro already exist with the same new name in either 
     32  * in a file hosting definition or usage of the macro, 
     33  * in files included by the said, 
     34  * in files that include the said. 
     35 
     36  * If one of the above conditions fails, the transformation starts an interaction to ask for a new macro name. 
     37 
     38 * If the user does not specify a macro or the specified macro does not exist, the transformation starts an interaction to ask for a macro. 
     39 
     40== Transformation steps and compensations == 
     41 
     42 1. The macro name is replaced with the new name at both definitions and all usage sites.