boolean operator NE (a, b) = a != b;
// String relational operators.
-boolean operator EQ_STRING (string a, string b) = compare_string (&a, &b) == 0;
-boolean operator GE_STRING (string a, string b) = compare_string (&a, &b) >= 0;
-boolean operator GT_STRING (string a, string b) = compare_string (&a, &b) > 0;
-boolean operator LE_STRING (string a, string b) = compare_string (&a, &b) <= 0;
-boolean operator LT_STRING (string a, string b) = compare_string (&a, &b) < 0;
-boolean operator NE_STRING (string a, string b) = compare_string (&a, &b) != 0;
+boolean operator EQ_STRING (string a, string b) = compare_string_3way (&a, &b) == 0;
+boolean operator GE_STRING (string a, string b) = compare_string_3way (&a, &b) >= 0;
+boolean operator GT_STRING (string a, string b) = compare_string_3way (&a, &b) > 0;
+boolean operator LE_STRING (string a, string b) = compare_string_3way (&a, &b) <= 0;
+boolean operator LT_STRING (string a, string b) = compare_string_3way (&a, &b) < 0;
+boolean operator NE_STRING (string a, string b) = compare_string_3way (&a, &b) != 0;
// Unary functions.
function ABS (x) = fabs (x);
size_t i;
for (i = 0; i < n; i++)
- if (!compare_string (&x, &a[i]))
+ if (!compare_string_3way (&x, &a[i]))
return 1.;
return 0.;
}
max = &a[0];
for (i = 1; i < n; i++)
- if (compare_string (&a[i], max) > 0)
+ if (compare_string_3way (&a[i], max) > 0)
max = &a[i];
return *max;
}
min = &a[0];
for (i = 1; i < n; i++)
- if (compare_string (&a[i], min) < 0)
+ if (compare_string_3way (&a[i], min) < 0)
min = &a[i];
return *min;
}
{
struct substring *w = &a[2 * i];
struct substring *y = &a[2 * i + 1];
- if (compare_string (w, &x) <= 0 && compare_string (&x, y) <= 0)
+ if (compare_string_3way (w, &x) <= 0 && compare_string_3way (&x, y) <= 0)
return 1.;
}
return 0.;