Is there a way to make a macro name case insensitive when defining it?
For example,
Consider the input stream: Mov MOV moV mOv
I want the m4 to output to be: mov mov mov mov
The naive way to do this is to define the following m4 macros:
define(Mov,mov)
define(MOV,mov)
define(moV,mov)
define(mOv,mov)
This method becomes tedious when we want to do the same for a 4 or 5 letter word. Is there a better way to do this?
If you want only string transform (want the m4 to output to be) you can use
translit:Your case:
Let's create an m4 macro called to_lowercase. Its definition looks as shown below.
Now, we can call our macro using
to_lowercase(Mov)',to_lowercase(mOV)'.