Re: m4 question

Chris Pickett <[email protected]> Wed, 16 Feb 2005 17:39:31 -0500
Newsgroups gmane.comp.java.vm.sablevm.devel
Message-ID <[email protected]>
David Bélanger wrote:
> On Wed, Feb 16, 2005 at 11:35:19AM -0500, Jennifer LHOTAK wrote:
> 
>>Hi,
>>
>>I've been working on project in sablevm and I'm trying to read in a code
>>attribute
>>that is very similar to the LineNumberTable attribute. I noticed there is
>>a macro that expands to the if/else statements which process the
>>attributes based on there names. This macro generates methods with part of
>>the id as the name giving to the macro. The problem I am having is that
>>the name of my attribute has a bunch of dots in it, so when it expands the
>>macro creates method ids with dots which is not allowed.
>>
>>So my question is should I not use the macro or should I fix it to change
>>dots to underscrores? And where can find more information about how these
>>macros work?
>>
>>Thanks
>>Jennifer
>>
> 
> 
> Hi Jennifer,
> 
> Try this quick untested patch as attachment.
> 
> Patch adds 2nd (optionnal) argument for textual comparison.
> First arg used for function names etc. as before.

I didn't try your patch, but I showed Jennifer a way to do with an extra 
m4svm_parse_attribute_elseifexternal macro that passes $1 and $2 to the 
strcmp, where $1 would be ca.mcgill.sable and the $2 would be the name 
of the attribute class, so that you'd get $1.$2 in your strcmp.  I was 
already using something similar in my sandbox, you just happened to 
respond before me.

Cheers,
Chris