Search code examples
adagnat

separate procedure in ada


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?


Solution

  • 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").