Rename compare_string --> compare_string_3way
authorJohn Darrington <john@darrington.wattle.id.au>
Sat, 11 Sep 2010 16:48:07 +0000 (18:48 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sat, 11 Sep 2010 16:48:07 +0000 (18:48 +0200)
src/language/expressions/helpers.c
src/language/expressions/helpers.h
src/language/expressions/operations.def

index 7e9e1d6cb542f8b15216c31fe8d9e90788609259..0b77919217ee18d6982f7d8e6a1c691874610287 100644 (file)
@@ -404,7 +404,7 @@ expr_date_sum (double date, double quantity, struct substring unit_name,
 }
 
 int
-compare_string (const struct substring *a, const struct substring *b)
+compare_string_3way (const struct substring *a, const struct substring *b)
 {
   size_t i;
 
index 895ec49bc90b30eaac7b7a1b208839fc3d6905f0..cb59c206a7599334246402cc26265854562d8483 100644 (file)
@@ -48,7 +48,7 @@ static inline double check_errno (double x)
 
 extern const struct substring empty_string;
 
-int compare_string (const struct substring *, const struct substring *);
+int compare_string_3way (const struct substring *, const struct substring *);
 
 double expr_ymd_to_date (double year, double month, double day);
 double expr_ymd_to_ofs (double year, double month, double day);
index 531d6b312a0284309ef32223fc7cd69271959673..844cab7e17ed133393d983bc02e6bf606b96ea4e 100644 (file)
@@ -63,12 +63,12 @@ boolean operator LT (a, b) = a < b;
 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);
@@ -118,7 +118,7 @@ boolean function ANY (string x, string a[n])
   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.;
 }
@@ -154,7 +154,7 @@ string function MAX (string a[n])
 
   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;
 }
@@ -185,7 +185,7 @@ string function MIN (string a[n])
 
   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;
 }
@@ -238,7 +238,7 @@ boolean function RANGE (string x, string a[n*2])
     {
       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.;