C Refactoring Workshop
C Refactoring Workshop is a tool for automatically performing refactorings on C source code. I originally developed this program to assist in improving the code of the Pantheon project for Intercept Technologies. The tool itself is written in Java and consists of about 12,000 lines of code.
Working on this project significantly enhanced my knowledge of the C language. Since this program's primary function is to make changes to C source code (without changing the observable behavior), I had to become very familar with the C grammar, which I obtained by reading the C99 Language Specification (ISO-IEC 9899).
Features
Notable features of this program include:- linear time refactorings (with respect to the number of files modified)
- renaming multiple identifiers simultaneously with Java regular expressions
-
To rename identifiers of the form *_structure_type to *_t, type:
refactor renameFamily identifier regex (.*)_structure_type $1_t
-
To rename identifiers of the form *_structure_type to *_t, type:
- preview/confirmation of refactoring changes
- ability to print forward and reverse call trees of functions
- locate all occurrences of a reference (e.g. an identifer)
- list the names of all references whose name matches a specified regular expression