comp.lang.ada
 help / color / mirror / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
Subject: Re: Resolving Long Filenames for Packages
Date: Thu, 25 Jan 2018 06:13:23 -0800 (PST)
Date: 2018-01-25T06:13:23-08:00	[thread overview]
Message-ID: <65063c98-03e6-4ff6-a582-26244837b0a5@googlegroups.com> (raw)
In-Reply-To: <ee6543c5-62a4-423d-8c22-30fd7a7bab39@googlegroups.com>

On Wednesday, January 24, 2018 at 10:23:20 AM UTC-6, alex...@junivörs.com wrote:
> expressions-parser-automata (the directory)
>     expressions-parser-automata-automaton_x.adb
>     expressions-parser-automata-automaton_x.ads
>     expressions-parser-automata-automaton_y.adb
>     expressions-parser-automata-automaton_y.ads
>     expressions-parser-automata-automaton_z.adb
>     expressions-parser-automata-automaton_z.ads
>     expressions-parser-automata-automaton_w.adb
>     expressions-parser-automata-automaton_w.ads
>     ...
> Once again, how would I generally go about structuring an Ada application to avoid such long filenames? Is there some sort of compiler option I can use? Can I do something about it inside my project (`gpr`) file?
> 
> Best regards,

The absolute name of each of these files is:
 /.../expressions-parser-automata-automaton/expressions-parser-automata-automaton_w.ads

There are two ways to make that shorter; shorten the file name part, or shorten the directory part.

As you point out in a later post, shortening the file name part while keeping the same package name requires one entry in the Naming config package per file, which is tedious and error prone.

You can also flatten the package hierarchy, but I'll assume you have a good reason for that hierarchy.

Shortening the directory part is easy; just put all the files in the parent directory.

You don't give a good rationale for using a subdirectory here; you say it is because the file names are "extremely long", but putting them in a subdirectory makes the names longer, so that makes no sense. 

One reason to use a subdirectory is to make it easier to select a different set of files for a particular project; do you have other projects that use the rest of this source code, but not the files in this directory?

It would be possible to modify gprbuild to support a second convention for file names, that maps the package hierarchy to the directory hierarchy as Java does. You'd have to put up money to convince AdaCore to implement that. 

You might be able use the gprname tool to automate generating the Naming package; that tool is documented in the gprbuild manual.

Personally, I much prefer a flatter directory hierarchy - that's one reason I prefer Ada over Java - certainly not the most important reason.

-- Stephe


      parent reply	other threads:[~2018-01-25 14:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-24 16:23 Resolving Long Filenames for Packages alexander
2018-01-24 17:21 ` Robert Eachus
2018-01-24 21:18 ` G. B.
2018-01-25  9:50 ` alexander
2018-01-25 14:13 ` Stephen Leake [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox