[Emacs-ada-mode] Main programs

Simon Wright simon at pushface.org
Wed Nov 19 12:27:13 PST 2008


On 19 Nov 2008, at 13:49, Stephen Leake wrote:

> Simon Wright <simon.j.wright at mac.com> writes:
>
>> I notice that ada-mode doesn't parse 'for Main use ("main-
>> program");'
>
> I assume that statement is in a gpr file.
>
> By "doesn't parse" do you mean "throws an error" or "doesn't seem to
> use the value"?

Doesn't seem to use the value.

>> (actually I'm not sure whether that should be the unit name or the
>> file name!). The current scheme seems to be 'assume that the unit in
>> the current buffer when you load a GPR is the main program'; might
>> be better to leave it up to the GPR to specify - until overridden by
>> a 'Set main and build'.
>
> Ah; you want to set the main program in the Emacs Ada mode project
> settings from the statment in the GPR file.
>
> This is problematic; there can be many programs listed in the "for
> Main" statement (the parens mean it's a list of strings); which would
> we use for the single current Emacs Ada mode project main program?

AdaCore's convert_prj uses the first of the list, if there is one.  
(was that not made available?)

At the moment ada-prj-default-make-cmd is
  (concat "${cross_prefix}gnatmake -o ${main} ${main} ${gnatmake_opt} "
	  "-cargs ${comp_opt} -bargs ${bind_opt} -largs ${link_opt}")

which forces us to have a ${main}. GPRs would let us say just
  (concat "${cross_prefix}gnatmake ${gnatmake_opt} "
	  "-cargs ${comp_opt} -bargs ${bind_opt} -largs ${link_opt}")

but then it would be harder to specify a non-default main!

> Also, the current output from gnatls doesn't list this setting. I
> don't see any 'gnat ...' commands that do output this information. So
> we'd have to add one, after figuring out the Ada code that would
> return it (the 'gnat list' source is _not_ pretty!).

That would be a bit of a stopper, I admit (but, again, what about  
convert_prj?



More information about the Emacs-ada-mode mailing list