5 Ironout_ is a C refactoring tool. It tries to be simple and fast.
7 .. _ironout: http://ironout.berlios.de
13 The command line interface has been enhanced to support using variable
14 names for specifying what to rename or find; see the examples in usage
17 A new function, ``typedef_name`` in ``typedef.c``, is called to decide
18 whether a name is a typedef or an identifier. This is the place to
19 change in order to support parsing files with typedefs.
21 There were many bug fixes and minor enhancements; now ironout can be
22 used on itself. See repository logs for more information.
28 Patches are welcome ;-)
32 Currently typedefs make parsing errors. The problem is C is a context
33 dependent language. That is we should know whether a name is an
34 identifier or a typedef when parsing the source code. I can think of
35 hacks to make it work for some situations but not a clean approach
36 that handles most. This will be improved in future.
40 I think the only reliable way of handling macros is to use a
41 pre-processor. But the problem is we need offset information
42 collected during parsing; the output of pre-processor tells us nothing
43 about the original source code name offsets.
45 So currently macro definitions are ignored and macro usages are
46 thought of as normal functions and variables (the latter might cause
47 syntax errors for complex macros).
51 In order to rename fields, we need to compute and save types involved
52 in a C program. Currently ironout does not do that; planned for
59 For compiling you'll need flex and bison. After compiling the
60 sources, a binary named ``ironout`` will be created; copy this file to
61 a folder in your ``$PATH`` if you like.
66 Ironout comes with a simple emacs minor mode. To make it work add::
68 (setq ironout-path "/path/to/compiled/ironout")
69 (load-file "/path/to/ironout.el")
71 to your ``~/.emacs`` file. The minor mode is automatically activated
72 in C files. You can use these commands:
74 ================= ======== ==============================
75 Command Key Description
76 ================= ======== ==============================
77 ironout-rename C-c i r show renaming changes in a buffer
78 ironout-find C-c i f find occurrences of a name
79 ================= ======== ==============================
81 You can use keys like "C-x `" that work with compilation buffer to
82 move through occurrences after ``ironout-find`` command.
87 You can use the command line interface to work with ``ironout``.
88 As an example if ``test.c`` contains::
96 You can test ironout with::
98 $ ironout find test.c 4
101 $ ironout rename test.c 4 newvar
113 Unless you're writing a plugin, working with offsets is hard; instead
114 you can use name hierarchies for specifying names. For instance, if
115 ``test.c`` contains::
126 These command are valid::
128 $ ironout rename test.c "struct var" newvar
129 diff --git a/test.c b/test.c
143 $ ironout rename test.c f:var newvar
144 diff --git a/test.c b/test.c
159 * All C files in the same directory as ``test.c`` are considered to be
160 in the same project. So renaming a name searches all of these
162 * A colon can be used to point to names inside functions; like
163 ``f:var`` as shown above
164 * struct, union, enum and label tags can be used to rename names with
165 tags; like ``struct var`` in above example.
171 Send patches, bug reports and feature requests to `ironout (at)
172 googlegroups.com`_. Send a mail to ``ironout-subscribe (at)
173 googlegroups.com`` to subscribe.
175 Also ironout's git repository is located at
176 git://git.berlios.de/ironout.
178 .. _`ironout (at) googlegroups.com`: http://groups.google.com/group/ironout
184 Ironout tests are located in ``tests`` folder. Running ``make test`` will
185 build ``tests/runtests``. It can be used like::
187 $ tests/runtests tests
189 ``runtests`` takes the directory which contains test files. The name
190 of each test file starts with ``test-``.
192 The format of this file is like::
196 SEP NEXT_COMMAND ARGS
200 Where ``SEP`` is a string that does not contain spaces; it is used to
201 find where commands start and end (currently a colon is used as the
202 separator in all of the tests). ``COMMAND`` shows what to do; they
203 are listed in the following table:
205 ========= ====== =================================================
206 Command Short Description
207 ========= ====== =================================================
208 write > Write the following block to file
209 read < Read file and check if its contents matches
211 ironout Execute ironout with the given arguments and make
212 sure the output matches the following block
213 comment # Ignore arguments and the following block
214 ========= ====== =================================================
216 For examples, see test files in ``tests`` directory.
221 This program is under the terms of GNU GPL. Have a look at COPYING
222 file for more information.