1.1 --- a/common.c Fri Dec 09 19:33:15 2022 +0100
1.2 +++ b/common.c Sat Dec 10 01:28:22 2022 +0100
1.3 @@ -34,6 +34,13 @@
1.4 fprintf(stderr, "Could not open source file for writing in directory %s (name %s).\n", dir, name);
1.5 }
1.6
1.7 +/* Test for a basename. */
1.8 +
1.9 +int is_basename(char *path)
1.10 +{
1.11 + return basename(path) == path;
1.12 +}
1.13 +
1.14 /* Obtain a new basename string. */
1.15
1.16 char *make_basename(const char *path)
1.17 @@ -77,6 +84,13 @@
1.18 return fp;
1.19 }
1.20
1.21 +/* Return whether an interface is a compound interface. */
1.22 +
1.23 +int is_compound_interface(struct interface *iface)
1.24 +{
1.25 + return iface->bases != NULL;
1.26 +}
1.27 +
1.28 /* Find an attribute value. */
1.29
1.30 char *get_attribute_value(struct attribute *attr, const char *name)
1.31 @@ -352,12 +366,26 @@
1.32 /* Return the maximum number of input items accepted by any one of the given
1.33 signatures. */
1.34
1.35 -int get_max_input_items(struct signature *sig)
1.36 +int get_max_input_items(struct interface *iface)
1.37 {
1.38 int input_words, input_items, output_words, output_items;
1.39 int max_input_items = 0;
1.40 + struct interface_ref *base;
1.41 + struct signature *sig;
1.42
1.43 - for (; sig != NULL; sig = sig->tail)
1.44 + /* Test any base interfaces. */
1.45 +
1.46 + for (base = iface->bases; base != NULL; base = base->tail)
1.47 + {
1.48 + input_items = get_max_input_items(base->iface);
1.49 +
1.50 + if (input_items > max_input_items)
1.51 + max_input_items = input_items;
1.52 + }
1.53 +
1.54 + /* Test the signatures. */
1.55 +
1.56 + for (sig = iface->signatures; sig != NULL; sig = sig->tail)
1.57 {
1.58 count_parameters(sig->parameters, &input_words, &input_items, &output_words, &output_items);
1.59