Preprocessor Question 
Author Message
 Preprocessor Question

Is there one macro I can use that will convert 'xxxx_fixed' to
'xxxx->fixed' where 'xxxx' is any string?  For example, I want
'foo_fixed' and 'bar_fixed' to be preprocessed into 'foo->fixed'
and 'bar->fixed' respectively with one macro.
( '#define _fixed ->fixed' will not work because there is a not a
whitespace before the '_' in 'xxxx_fixed'. )

Thanks,
john

--



Fri, 23 Nov 2001 03:00:00 GMT  
 Preprocessor Question

# Is there one macro I can use that will convert 'xxxx_fixed' to
# 'xxxx->fixed' where 'xxxx' is any string?

No.

# ( '#define _fixed ->fixed' will not work because there is a not a
# whitespace before the '_' in 'xxxx_fixed'. )

Right. There's no way to split tokens in C the way you need to.

I wonder why you want to do this in the first place. If the replacement
is actually permanent, why not rewrite the source code once and for
all? This can be semi-automated using search/replace in almost any editor
or fully-automated using perl -pe 's/([A-Z_a-z0-9]+)_fixed/$1->fixed/'.

Regards,

        Jens
--
Jens Schweikhardt  http://www.shuttle.de/schweikh/
SIGSIG -- signature too long (core dumped)
--



Fri, 23 Nov 2001 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Preprocessor Question: #if A && B

2. preprocessor question

3. Preprocessor question

4. Preprocessor question

5. Preprocessor question

6. Preprocessor question

7. preprocessor question

8. Preprocessor questions

9. Preprocessor question: converting code into a string

10. Preprocessor Question

11. preprocessor question

12. A preprocessor question

 

 
Powered by phpBB® Forum Software