check if value of variable equals some constant
I want to do:
mpp -set x=true foo.mpp
mpp -set x=false foo.mpp
and then in foo.mpp, do something like
{{if (( get x )) = true
Got true.
}}
{{if (( get x )) = false
Got false.
}}
Is there some way to do the above?
On Fri, 7 Mar 2014 07:59:38 -0800, Ashish Agarwal wrote:
I want to do:
mpp -set x=true foo.mpp mpp -set x=false foo.mpp
and then in foo.mpp, do something like
{{if (( get x )) = true Got true. }} {{if (( get x )) = false Got false. }}
For a simple true/false you can use
{{ ifdef x X is defined }} {{ ifndef x X is not defined }}
and then set (or not) “x”.
I chose a bad example. I meant for non-Boolean types. I'm doing exactly what you suggest for Booleans.
Since MPP doesn't currently have value comparison (I do hope to implement something for that in the next 7 weeks), you'd have to use ifcmd if you really need to compare strings in a similar way.
Currently, if you need more powerful features, I suggest you use what I showed in http://pw374.github.io/posts/2013-10-03-20-35-12-using-mpp-two-different-ways.html#Example2usingOCamlasapreprocessorlanguage