Hi all
I'd like to test for string equality. I can do this in some ways if the string is hardcoded, but if the string is defined as a prm (or local), then I start breaking things.
#prm and #if works, but I need some implementation of #local
My tests so far:
Using #m_if
macro crash_me(first) {
#m_if first == "foo";
first is true __
#m_else
first is false __
#m_endif
}
crash_me("foo") 'this works correctly
prm first = "foo";
crash_me(first) 'This one straight up makes TOPAS just exit v5,6,7
Using #if
macro prm_not_defined(first) {
#if first == "foo";
first is true __
#else
first is false __
#endif
}
prm_not_defined("foo") 'this works correctly
#prm second = "foo";
prm_not_defined(second) 'this works correctly - but I need #local
prm second = "foo";
prm_not_defined(second) 'this one (kind of expectedly) fails with: #prm [ second ] not defined
Using if
macro normal_if(first) {
if first == "foo" {
prm a_prm = 1;
} else {
prm a_prm = -1;
}
}
normal_if("foo") 'this works correctly
prm = a_prm; : 0
prm third = "foo";
normal_if(third) ' Equation error for String in kget_d : foo
Using the If() function
prm fourth = "foo";
prm a_prm = If("foo" == "foo", 1, -1); : 1 'this works correctly
prm other_prm = If(fourth == "foo", 1, -1); : 1 'Equation error for String in kget_d : foo