add namespace to some names
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 4 Jul 2022 19:56:53 +0000 (12:56 -0700)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 4 Jul 2022 19:56:53 +0000 (12:56 -0700)
src/language/stats/ctables.c

index a29361cc3cc3be987e7d67ab5be8703c596243eb..5df2435b7b17f7eb785a4800a68738e525905613 100644 (file)
@@ -4713,7 +4713,8 @@ struct operator
   };
 
 static const struct operator *
-match_operator (struct lexer *lexer, const struct operator ops[], size_t n_ops)
+ctable_pcexpr_match_operator (struct lexer *lexer,
+                              const struct operator ops[], size_t n_ops)
 {
   for (const struct operator *op = ops; op < ops + n_ops; op++)
     if (lex_token (lexer) == op->token)
@@ -4728,15 +4729,16 @@ match_operator (struct lexer *lexer, const struct operator ops[], size_t n_ops)
 }
 
 static struct ctables_pcexpr *
-parse_binary_operators__ (struct lexer *lexer, struct dictionary *dict,
-                          const struct operator ops[], size_t n_ops,
-                          parse_recursively_func *parse_next_level,
-                          const char *chain_warning,
-                          struct ctables_pcexpr *lhs)
+ctable_pcexpr_parse_binary_operators__ (
+  struct lexer *lexer, struct dictionary *dict,
+  const struct operator ops[], size_t n_ops,
+  parse_recursively_func *parse_next_level,
+  const char *chain_warning, struct ctables_pcexpr *lhs)
 {
   for (int op_count = 0; ; op_count++)
     {
-      const struct operator *op = match_operator (lexer, ops, n_ops);
+      const struct operator *op
+        = ctable_pcexpr_match_operator (lexer, ops, n_ops);
       if (!op)
         {
           if (op_count > 1 && chain_warning)
@@ -4757,20 +4759,23 @@ parse_binary_operators__ (struct lexer *lexer, struct dictionary *dict,
 }
 
 static struct ctables_pcexpr *
-parse_binary_operators (struct lexer *lexer, struct dictionary *dict,
-                        const struct operator ops[], size_t n_ops,
-                        parse_recursively_func *parse_next_level,
-                        const char *chain_warning)
+ctable_pcexpr_parse_binary_operators (struct lexer *lexer,
+                                      struct dictionary *dict,
+                                      const struct operator ops[], size_t n_ops,
+                                      parse_recursively_func *parse_next_level,
+                                      const char *chain_warning)
 {
   struct ctables_pcexpr *lhs = parse_next_level (lexer, dict);
   if (!lhs)
     return NULL;
 
-  return parse_binary_operators__ (lexer, dict, ops, n_ops, parse_next_level,
-                                   chain_warning, lhs);
+  return ctable_pcexpr_parse_binary_operators__ (lexer, dict, ops, n_ops,
+                                                 parse_next_level,
+                                                 chain_warning, lhs);
 }
 
-static struct ctables_pcexpr *parse_add (struct lexer *, struct dictionary *);
+static struct ctables_pcexpr *ctable_pcexpr_parse_add (struct lexer *,
+                                                       struct dictionary *);
 
 static struct ctables_pcexpr
 ctpo_cat_range (double low, double high)
@@ -4782,7 +4787,7 @@ ctpo_cat_range (double low, double high)
 }
 
 static struct ctables_pcexpr *
-parse_primary (struct lexer *lexer, struct dictionary *dict)
+ctable_pcexpr_parse_primary (struct lexer *lexer, struct dictionary *dict)
 {
   int start_ofs = lex_ofs (lexer);
   struct ctables_pcexpr e;
@@ -4866,7 +4871,7 @@ parse_primary (struct lexer *lexer, struct dictionary *dict)
     }
   else if (lex_match (lexer, T_LPAREN))
     {
-      struct ctables_pcexpr *ep = parse_add (lexer, dict);
+      struct ctables_pcexpr *ep = ctable_pcexpr_parse_add (lexer, dict);
       if (!ep)
         return NULL;
       if (!lex_force_match (lexer, T_RPAREN))
@@ -4900,7 +4905,7 @@ ctables_pcexpr_allocate_neg (struct ctables_pcexpr *sub,
 }
 
 static struct ctables_pcexpr *
-parse_exp (struct lexer *lexer, struct dictionary *dict)
+ctable_pcexpr_parse_exp (struct lexer *lexer, struct dictionary *dict)
 {
   static const struct operator op = { T_EXP, CTPO_POW };
 
@@ -4910,8 +4915,9 @@ parse_exp (struct lexer *lexer, struct dictionary *dict)
       "To disable this warning, insert parentheses.");
 
   if (lex_token (lexer) != T_NEG_NUM || lex_next_token (lexer, 1) != T_EXP)
-    return parse_binary_operators (lexer, dict, &op, 1,
-                                   parse_primary, chain_warning);
+    return ctable_pcexpr_parse_binary_operators (lexer, dict, &op, 1,
+                                                 ctable_pcexpr_parse_primary,
+                                                 chain_warning);
 
   /* Special case for situations like "-5**6", which must be parsed as
      -(5**6). */
@@ -4925,8 +4931,9 @@ parse_exp (struct lexer *lexer, struct dictionary *dict)
   };
   lex_get (lexer);
 
-  struct ctables_pcexpr *node = parse_binary_operators__ (
-    lexer, dict, &op, 1, parse_primary, chain_warning, lhs);
+  struct ctables_pcexpr *node = ctable_pcexpr_parse_binary_operators__ (
+    lexer, dict, &op, 1,
+    ctable_pcexpr_parse_primary, chain_warning, lhs);
   if (!node)
     return NULL;
 
@@ -4935,13 +4942,13 @@ parse_exp (struct lexer *lexer, struct dictionary *dict)
 
 /* Parses the unary minus level. */
 static struct ctables_pcexpr *
-parse_neg (struct lexer *lexer, struct dictionary *dict)
+ctable_pcexpr_parse_neg (struct lexer *lexer, struct dictionary *dict)
 {
   int start_ofs = lex_ofs (lexer);
   if (!lex_match (lexer, T_DASH))
-    return parse_exp (lexer, dict);
+    return ctable_pcexpr_parse_exp (lexer, dict);
 
-  struct ctables_pcexpr *inner = parse_neg (lexer, dict);
+  struct ctables_pcexpr *inner = ctable_pcexpr_parse_neg (lexer, dict);
   if (!inner)
     return NULL;
 
@@ -4950,7 +4957,7 @@ parse_neg (struct lexer *lexer, struct dictionary *dict)
 
 /* Parses the multiplication and division level. */
 static struct ctables_pcexpr *
-parse_mul (struct lexer *lexer, struct dictionary *dict)
+ctable_pcexpr_parse_mul (struct lexer *lexer, struct dictionary *dict)
 {
   static const struct operator ops[] =
     {
@@ -4958,13 +4965,14 @@ parse_mul (struct lexer *lexer, struct dictionary *dict)
       { T_SLASH, CTPO_DIV },
     };
 
-  return parse_binary_operators (lexer, dict, ops, sizeof ops / sizeof *ops,
-                                 parse_neg, NULL);
+  return ctable_pcexpr_parse_binary_operators (lexer, dict, ops,
+                                               sizeof ops / sizeof *ops,
+                                               ctable_pcexpr_parse_neg, NULL);
 }
 
 /* Parses the addition and subtraction level. */
 static struct ctables_pcexpr *
-parse_add (struct lexer *lexer, struct dictionary *dict)
+ctable_pcexpr_parse_add (struct lexer *lexer, struct dictionary *dict)
 {
   static const struct operator ops[] =
     {
@@ -4973,8 +4981,9 @@ parse_add (struct lexer *lexer, struct dictionary *dict)
       { T_NEG_NUM, CTPO_ADD },
     };
 
-  return parse_binary_operators (lexer, dict, ops, sizeof ops / sizeof *ops,
-                                 parse_mul, NULL);
+  return ctable_pcexpr_parse_binary_operators (lexer, dict,
+                                               ops, sizeof ops / sizeof *ops,
+                                               ctable_pcexpr_parse_mul, NULL);
 }
 
 static struct ctables_postcompute *
@@ -5009,7 +5018,7 @@ ctables_parse_pcompute (struct lexer *lexer, struct dictionary *dict,
     }
 
   int expr_start = lex_ofs (lexer);
-  struct ctables_pcexpr *expr = parse_add (lexer, dict);
+  struct ctables_pcexpr *expr = ctable_pcexpr_parse_add (lexer, dict);
   int expr_end = lex_ofs (lexer) - 1;
   if (!expr || !lex_force_match (lexer, T_RPAREN))
     {