1.1 --- a/docs/idl.1 Sat Nov 09 01:18:22 2019 +0100
1.2 +++ b/docs/idl.1 Sat Nov 09 16:48:03 2019 +0100
1.3 @@ -22,6 +22,14 @@
1.4 to, and accessed by, libraries and applications as if these things happened to
1.5 be resident in the same program.
1.6 .PP
1.7 +Components can support one or many different interfaces by composing them into a
1.8 +single compound interface, with the different interfaces and operations
1.9 +distinguished using protocol and operation code (opcode) information embedded in
1.10 +the invocation information for a given operation.
1.11 +.B idl
1.12 +supports the generation of code to select the appropriate interface when
1.13 +handling invocations.
1.14 +.PP
1.15 The interface description or definition language (IDL) employed by
1.16 .B idl
1.17 is broadly similar to that used by systems such as CORBA. Indeed, a tool called
1.18 @@ -75,17 +83,19 @@
1.19 configuration has been selected.
1.20 .PP
1.21 If the
1.22 -.BR \-c ", " \-\-client ", " \-s ", " \-\-server ", " \-C " or " \-\-compound
1.23 +.BR \-c ", " \-\-client ", " \-s ", " \-\-server ", " \-C ", " \-\-comp ", "
1.24 +.BR \-N " or " \-\-comp-name
1.25 options are not given, output is produced for client and server configurations.
1.26 .PP
1.27 Some options may be followed by a value, either immediately after the long form
1.28 of the option and an equals sign (\fB=\fP) or in the argument that follows them:
1.29 .PP
1.30 .TP
1.31 -.BR \-C ", " \-\-compound
1.32 -Generate compound interface files, indicating the name of the compound interface
1.33 -which will also be the prefix of the generated files; such files are employed by
1.34 -servers to pass control to individual interfaces.
1.35 +.BR \-C ", " \-\-comp
1.36 +Generate compound (or composite, or component) interface files, indicating the
1.37 +name of the compound interface which will also be the prefix of the generated
1.38 +files; such files are employed by servers to pass control to individual
1.39 +interfaces.
1.40 .TP
1.41 .BR \-d ", " \-\-dir
1.42 Indicate the output directory for generated files.
1.43 @@ -94,6 +104,12 @@
1.44 Select the programming language to be used for output; currently only
1.45 .BR C " and " C++
1.46 are accepted as values for this option.
1.47 +.TP
1.48 +.BR \-N ", " \-\-comp-name
1.49 +Select a different name for a compound (or composite, component) interface than
1.50 +that indicated by the
1.51 +.BR \-C " or " \-\-comp
1.52 +options.
1.53 .SH EXAMPLES
1.54 Compile the interfaces in
1.55 .IR hello.idl ,
1.56 @@ -216,7 +232,7 @@
1.57 .PP
1.58 For server components, compound interface files can also be produced with their
1.59 names chosen using the
1.60 -.BR \-C " or " \-\-compound
1.61 +.BR \-C " or " \-\-comp
1.62 options. With a value of
1.63 .I name
1.64 given with these options, files of the following form are produced:
1.65 @@ -226,6 +242,10 @@
1.66 mechanism to function, also to be used by the actual component implementing the
1.67 interfaces.
1.68 .TP
1.69 +.IR name _interfaces.h
1.70 +contains include statements referencing individual interfaces, needed by the
1.71 +above compound interface declaration.
1.72 +.TP
1.73 .IR name "_server.c or " name _server.cc
1.74 contains the function definitions needed to dispatch to the interfaces.
1.75 .TP
1.76 @@ -265,7 +285,7 @@
1.77 .PP
1.78 Each individual component exporting interfaces must have dispatch functions
1.79 generated using the
1.80 -.BR \-C " or " \-\-compound
1.81 +.BR \-C " or " \-\-comp
1.82 options. The generated code is combined with the other server code generated for
1.83 the individual interfaces.
1.84 .PP
2.1 --- a/main.c Sat Nov 09 01:18:22 2019 +0100
2.2 +++ b/main.c Sat Nov 09 16:48:03 2019 +0100
2.3 @@ -45,6 +45,7 @@
2.4 /* Compound interface and dispatcher output. */
2.5
2.6 char *output_compound = NULL;
2.7 +char *output_compound_name = NULL;
2.8
2.9 int output_client = 0;
2.10 int output_server = 0;
2.11 @@ -116,11 +117,12 @@
2.12 /* long opt following var pointer short opt */
2.13 {"all", no_argument, NULL, 'a' },
2.14 {"client", no_argument, NULL, 'c' },
2.15 - {"compound", required_argument, NULL, 'C' },
2.16 + {"comp", required_argument, NULL, 'C' },
2.17 {"dir", required_argument, NULL, 'd' },
2.18 {"headers", no_argument, NULL, 'h' },
2.19 {"interfaces", no_argument, NULL, 'i' },
2.20 {"language", required_argument, NULL, 'l' },
2.21 + {"comp-name", required_argument, NULL, 'N' },
2.22 {"routines", no_argument, NULL, 'r' },
2.23 {"server", no_argument, NULL, 's' },
2.24 {"verbose", no_argument, NULL, 'v' },
2.25 @@ -144,7 +146,7 @@
2.26
2.27 while (1)
2.28 {
2.29 - option = getopt_long(argc, argv, "acC:d:hil:rsv", long_options, NULL);
2.30 + option = getopt_long(argc, argv, "acC:d:hil:N:rsv", long_options, NULL);
2.31 if (option == -1)
2.32 break;
2.33
2.34 @@ -164,9 +166,11 @@
2.35 output_selected_role = 1;
2.36 break;
2.37
2.38 - /* Select compound interface name and output. */
2.39 + /* Select compound interface filename prefix and output. */
2.40 case 'C':
2.41 output_compound = optarg;
2.42 + if (output_compound_name == NULL)
2.43 + output_compound_name = output_compound;
2.44 output_selected_role = 1;
2.45 break;
2.46
2.47 @@ -200,6 +204,14 @@
2.48 }
2.49 break;
2.50
2.51 + /* Select compound interface name and output. */
2.52 + case 'N':
2.53 + output_compound_name = optarg;
2.54 + if (output_compound == NULL)
2.55 + output_compound = output_compound_name;
2.56 + output_selected_role = 1;
2.57 + break;
2.58 +
2.59 /* Generate routines (definitions). */
2.60 case 'r':
2.61 output_routines = 1;
3.1 --- a/program.c Sat Nov 09 01:18:22 2019 +0100
3.2 +++ b/program.c Sat Nov 09 16:48:03 2019 +0100
3.3 @@ -33,7 +33,8 @@
3.4
3.5 /* Program state set in the main program. */
3.6
3.7 -extern char *output_prefix, *output_dir, *output_compound;
3.8 +extern char *output_prefix, *output_dir,
3.9 + *output_compound, *output_compound_name;
3.10
3.11 extern int output_client, output_server,
3.12 output_headers, output_interfaces, output_routines,
3.13 @@ -173,14 +174,13 @@
3.14
3.15 if (compound_dispatch_fp != NULL)
3.16 {
3.17 - fprintf(compound_dispatch_fp, compound_dispatch_prologue,
3.18 - output_compound, output_compound, output_compound);
3.19 + fprintf(compound_dispatch_fp, compound_dispatch_prologue, output_compound);
3.20
3.21 /* Write the handler function. */
3.22
3.23 write_compound_handler_signature(compound_dispatch_fp);
3.24 fputs("\n", compound_dispatch_fp);
3.25 - fprintf(compound_dispatch_fp, compound_handle_function, output_compound);
3.26 + fprintf(compound_dispatch_fp, compound_handle_function, output_compound_name);
3.27
3.28 /* Write the dispatch function. */
3.29
3.30 @@ -207,7 +207,7 @@
3.31
3.32 if (compound_interface_fp != NULL)
3.33 fprintf(compound_interface_fp, compound_interface_prologue,
3.34 - output_compound, output_compound);
3.35 + output_compound, output_compound_name);
3.36
3.37 if (compound_interfaces_fp != NULL)
3.38 fputs(compound_interfaces_prologue, compound_interfaces_fp);
3.39 @@ -284,7 +284,7 @@
3.40 compound_dispatch_function_signature_cpp :
3.41 compound_dispatch_function_signature_c;
3.42
3.43 - fprintf(fp, s, output_compound, output_compound);
3.44 + fprintf(fp, s, output_compound_name, output_compound_name);
3.45 }
3.46
3.47 void write_compound_handler_signature(FILE *fp)
3.48 @@ -293,7 +293,7 @@
3.49 compound_handle_function_signature_cpp :
3.50 compound_handle_function_signature_c;
3.51
3.52 - fprintf(fp, s, output_compound, output_compound);
3.53 + fprintf(fp, s, output_compound_name, output_compound_name);
3.54 }
3.55
3.56 /* Augment a compound interface class declaration. */
3.57 @@ -317,7 +317,7 @@
3.58 if (compound_dispatch_header_fp != NULL)
3.59 {
3.60 fprintf(compound_dispatch_header_fp, compound_dispatch_header_epilogue,
3.61 - output_compound, max_input_items);
3.62 + output_compound_name, max_input_items);
3.63 fclose(compound_dispatch_header_fp);
3.64 }
3.65