JSA Research & Innovation

Command-Line Driver Generator for Ada

The declarations of subprograms in the public part of an Ada package specification can be seen as a declaration of how you are supposed to call the features implemented in the package.

So why should you have to write command-line interfaces myself? Why not let a tool translate between the Ada package specification and the command-line interface?

Last year I was sufficiently tired of writing command-line interfaces, to actually start writing such a tool, and in August 2015 it was first released under an Open Source license.

The generated command-line driver takes GNU long-args style named arguments and is aware of which formal parameters have default values, so if we have a package specification:

with Ada.Strings;
package Trim is
   use Ada.Strings;

   procedure Filter (Sides : in     Trim_End := Both);
   --  Reads lines from standard input,
   --  removes leading/trailing spaces, and
   --  writes the trimmed lines to standard output.
end Trim;

Then the generated command-line driver, trim-driver, can be called like this:

trim-driver
trim-driver --sides=both
trim-driver --sides=left
trim-driver --sides=right

Where the first two forms are equivalent.

You can download the command-line driver generator here.

Please call or write if you are interested in support for, or further development of the command-line driver generator for Ada.

If you have questions or requests, please send them to <services@jacob-sparre.dk>, or call +45 21 49 08 04.








PortfolioCurriculum vitaePublication listProductsServicesScienceRSS feedsCalendar

JSA Research & Innovation • Jægerparken 5, 2. th. • 2970 Hørsholm • Danmark

jacob@jacob-sparre.dkwww.jacob-sparre.dk