bug-m4
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cannot insert sharps


From: Gary V. Vaughan
Subject: Re: Cannot insert sharps
Date: Thu, 30 Sep 2004 11:41:40 +0100
User-agent: Mozilla Thunderbird 0.8 (X11/20040913)

Hi Matthieu,

Matthieu Pupat wrote:
> I try a simple macro that prepone a sharp (#) before names beginning
> with i or o and quoting other names :
> 
> define(`QuoteVariable', `ifelse(substr($1,0,1), i, #$1,
> ifelse(substr($1,0,1), o, #$1, "$1" ) ) ')

[...]

> Is this a bug ?

Nope, your macro is underquoted so the # is treated as a comment as the
macro expansion stack unwinds.

> What can I do to get rid of this ?

Add more quotes!  I haven't tested this, but something more like this
should give you more success:

define(`QuoteVariable',
`ifelse(`substr(`$1', 0, 1)', `i', `#$1',
  `ifelse(`substr(`$1', 0, 1)', `o', `#$1', `"$1"')')')

However, you could do the same thing much more easily with the patsubst
macro (if you quote it correctly!).

Cheers,
        Gary.

-- 
Gary V. Vaughan      ())_.  address@hidden,gnu.org}
Research Scientist   ( '/   http://tkd.kicks-ass.net
GNU Hacker           / )=   http://www.gnu.org/software/libtool
Technical Author   `(_~)_   http://sources.redhat.com/autobook

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]