3

I have a very big project, and I'm trying to start using GPS (Gnat Programming Studio) instead of what I have.

The naming conventions of the proj are as following:

something.1.ada for a spec

something.2.ada for a body

parents.son.2.ada for separate procedure/functions where the parent is where the separate function/procedure is declared and son is the name of the separate function/procedure. It might even be more complicated, as in grandparent.parent.son.2.ada

My problem is I can't configure GPS to recognize the separate functions/procedures as source files in the project.

It is a huge project so changing the names of the files or any other change in the code itself is not an option for me as it will cause for too much trouble.

How do I configure GPS correctly?

Shai
  • 111,146
  • 38
  • 238
  • 371
itay
  • 41
  • 3

2 Answers2

5

You need a GNAT Project file with package Naming. Your naming scheme sounds like the Apex naming scheme, discussed in the GPRbuild User's Guide - specifically here.

So that would be

package Naming is
   for Casing               use "lowercase";
   for Dot_Replacement      use ".";
   for Spec_Suffix ("Ada")  use ".1.ada";
   for Body_Suffix ("Ada")  use ".2.ada";
end Naming;

I don't think you need

   for Separate_Suffix ("Ada") use ".2.ada";

because

It denotes the suffix used in file names that contain separate bodies. If it is not specified, then it defaults to same value as Body_Suffix ("Ada").

Simon Wright
  • 25,108
  • 2
  • 35
  • 62
  • so in my case i should define: casing: mixedcase dot replacement: _ spec suffix: .1.ada body suffix: .2.ada separate suffix: .2.ada is that correct? thanks for the help – itay Aug 20 '11 at 12:08
  • Well, you seem to need lowercase not mixedcase. I updated the answer rather than commenting so as to get the formatting right – Simon Wright Aug 20 '11 at 12:28
2

Another option Simon didn't mention is to run gnatchop on your program. gnatchop is a program that will rename all your files to the names that Gnat by default looks for.

It does have the drawback that the result won't have the files named and arranged the way it was before. However, it can be a lot less work than manually building a mapping file or tweaking the project's naming scheme until things work.

T.E.D.
  • 44,016
  • 10
  • 73
  • 134
  • thanks,but simon solution worked perfactly for me and kept thing in the project exactly the way they were. – itay Aug 25 '11 at 09:38
  • ok, i know i should post new question for it but the forum claims it doesn't meet the quality standards... so i will ask it here. the project uses 20+ extarnel libraries. how do i add those libraries to the project to make it compile? thanks very much – itay Aug 25 '11 at 09:57
  • @itay - External (prebuilt) libraries wouldn't enter into it. If you have more Ada source code that has to be compiled, that would need to be gnatchopped too. If you have a solution that works already though, I wouldn't bother. Just remember you can do this for future reference. – T.E.D. Aug 25 '11 at 13:17
  • +1 I'd forgotten about `gnatchop`, and its inverse, `cat`. :-) – trashgod Sep 06 '11 at 16:59