Re: Batch Editing source code
DNewsRWebbGroup@gmail.com wrote:
> { for VC++-specific inquiries, consider microsoft.public.vc.* forums.
-mod }
> I am working with a large amount of code. If I modify function
> parameters, for example add a parameter, I want to be able to
> change every function call to add an argument. Is there a tool
> for this? I am using Visual C++ 8.
Editing tools are independant of the language and (usually, at
least) the operating system. I don't know of an editor which
doesn't support global search and replace.
Following Allan's suggestion, the usual solution here is to add
the parameter at the end, and to give it a default value. If
for some reason that isn't possible, a global search and replace
on all of the source files to change the calls which have the
expected format, and compiler errors to catch the odd case where
the search regular expression missed a call.
FWIW: my preferred editor solution here, including with VC++
under Windows, is gvim ` find ... `, then the command :argdo in
gvim. Most of the other solutions I'm aware of involve
specifying the actual search and replace command on the command
line, and invoking the editor in batch mode separately for each
file.
I'm not sure how you invoke the Visual Studios editor in batch
mode from a script, although I'm sure it's possible. On the
other hand, the development environment understands projects, so
I can't imagine it not having something like gvim's argdo, only
more powerful, to execute a given editor command on all of a
certain class of source files in the project.
--
James Kanze kanze.james@neuf.fr
Conseils en informatique orient?e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S?mard, 78210 St.-Cyr-l'?cole, France +33 (0)1 30 23 00 34
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]