Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!mailrus!tut.cis.ohio-state.edu!bloom-beacon!mcgill-vision!mouse From: mouse@mcgill-vision.UUCP (der Mouse) Newsgroups: comp.lang.c Subject: Re: Macro parameters getting substituted into strings Message-ID: <1043@mcgill-vision.UUCP> Date: 12 Apr 88 08:27:49 GMT References: <11879@brl-adm.ARPA> <4099@hoptoad.uucp> <7309@brl-smoke.ARPA> <3222@haddock.ISC.COM> Organization: McGill University, Montreal Lines: 17 In article <3222@haddock.ISC.COM>, karl@haddock.ISC.COM (Karl Heuer) writes: > In article <8035@elsie.UUCP> ado@elsie.UUCP (Arthur David Olson) writes: >> #define LETR_a 'a' [ditto for all of 'a'..'z', 'A'..'Z'] >> #define CTRL(c) ((LETR_ ## c) & 037) > Since you have to edit the source file anyway, why don't you just do > it right in the first place? > 1,$s/CTRL(\(.\))/CTRL('\1')/g > /^#define CTRL/s/.*/#define CTRL(c) ((c) & 037)/ Because there is no "the" source file. There may be many source files involved. Arthur's fix involves changing only the file in which CTRL is defined; your fix invovles changing not only that file but also all files which use it. This may be impractical or even impossible. der Mouse uucp: mouse@mcgill-vision.uucp arpa: mouse@larry.mcrcim.mcgill.edu