LibreFrame

GNAT Studio LibreDatabase Plugin

Integrates seamlessly into GNAT Studio

The GNATStudio IDE in debugger mode.

The GNATStudio IDE with popup window in LDS file.

Introduction

You may wish to install this plugin, which allows you to integrate LibreDatabase Specification files (.lds extension) into GNATStudio.

It is also available on the Sowebio – Sowneo GitHub repository in the GNAT Studio LDS extension repository named ‘adel-gnatstudio-lds_extension’.

It takes into account the new keywords ‘database’ and ‘table’, handles types on mouse-over, and accounts for the special case of the `Reference` function, which is not a type.

The plugin recursively lists all declarations in all .ads and .adb files within the project’s scope—including subtypes and renames—that are related to Libadalang.

The tooltip does not appear if the type reference cannot be found.

All of these features make the extension pleasant and unobtrusive to use.

Excerpt from an LDS (LibreDatabase Specification) file

The syntax of LibreDatabase specification files follows Ada semantics and directly incorporates the language’s data types.

database Srp.DB
  with
    Type => LibreDatabase,
    Description => "Database for Sowebio Ressource Planner"

is

   ----------------------------------------------------------------------------
   table Adm_Config with
      Description => "Key-Value table for parameter persistences"
   is
      package Columns is
         Number : Unsigned_128 with Auto_Increment, Description => "Parameter number";
         DTS_Creation : AC.Time with Description => "Creation date time stamp";
         DTS_Update : AC.Time with Description => "Update date time stamp";
         DTS_Origin : DString with Description => "Agent or user who performed the last action on this raw";
         Parameter : DString with Description => "Parameter name";
         Value : DString with Description => "Parameter value";
      end Columns;
      package Indexes is
         Parameter : Unique_Index with Description => "Fast parameter access";
      end Indexes;
   end Adm_Config;

   ----------------------------------------------------------------------------
   table Adm_User with
      Description => "Administrator users table"
   is
      package Columns is
         Number : Unsigned_128 with Auto_Increment, Description => "Administrator user number";
         DTS_Creation : AC.Time with Description => "User creation date time stamp";
         DTS_Update : AC.Time with Description => "User update date time stamp";
         DTS_Origin : DString with Description => "Agent or user who performed the last action on this raw";
         Email : DString with Description => "User email";
         Password : Unsigned_128 with Description => "User hashed password";
         Password_Errors : Natural := 0 with Description => "Password errors counter";
         Password_Validity : Natural := 0 with Description => "Password validity in seconds";
         Connection_Total : Natural := 0 with Description => "Duration of cumulated connections";
         Connection_Counter : Natural := 0 with Description => "Total number of connections";
         Connection_Info : DString with Description => "Current or last connection info (Date time stamp, IP, ...)";
         Name : DString with Description => "User name";
         Invited_By : Reference (Adm_User) with Description => "Reference to the inviting user's name";
         Attributes : User_Attributes := [others => False] with
           Description => "User attributes including:
                           - Grants (permissions),
                           - Properties (Property_1:Value,Property_2:value...Property_N),
                           - Language (Language from country code ISO 3166-1 alpha-2),
                           - Time zone (Time zone TZ Database compliant see Wikipedia page),
                           - Theme name.";
         Status : DString with Description => "Status";
         Comment : DString with Description => "Comment";
      end Columns;
      package Indexes is
         DTS_Creation : Non_Unique_Index with Description => "Registration date sorting";
         Email : Unique_Index with Description => "Email sorting for logging";
	 Name : Non_Unique_Index with Description => "Name sorting";
      end Indexes;
   end Adm_User;

   ----------------------------------------------------------------------------
   table Adm_Job with
      Description => "Jobs table"
   is
      package Columns is
         Number : Unsigned_128 with Auto_Increment, Description => "Job number";
         DTS_Creation: AC.Time with Description => "Job creation date time stamp";
         DTS_Start : AC.Time with Description => "Job start date time stamp: 00000000-000000 for immediate start";
         DTS_Started : AC.Time with Description => "Job started date time stamp";
         DTS_Paused : AC.Time with Description => "Job paused date time stamp";
         DTS_Stopped : AC.Time with Description => "Job paused date time stamp";
         DTS_Origin : DString with Description => "Agent or user who performed the last action on this raw";
         LPQ_Group : Task_Groups := [others => None] with
           Description => "Acts as a Logical Priority Queue (LPQ). Groups (non-exhaustive list):
                           - Backup,
                           - Background,
                           - File_Import,
                           - Scraping,
                           - Test";
         LPQ_Priority : Integer with Description => "A lower value denotes a higher priority: 0=max 4=medium 9=min";
         Operation : DString with Description => "Operation name for execution";
         Reporting : DString with Description => "Reporting messages from the task (64KB max)";
         Properties : DString with Description => "Properties (Property_1:Value,Property_2:value...Property_N)";
         Status : Status_Attributes := [others => Idle] with
           Description => "Job status:
                           - Awaiting: Waiting to be launched,
                           - Ghost: Invisible - i.e. not displayed,
                           - Paused: Paused during execution, after beeing launched,
                           - Running: Running normally,
                           - Done: Stopped after successful execution,
                           - Cancel: Stopped after being cancelled,
                           - Errored: Stopped after an unrecoverable error.";
         Comment : DString with Description => "Comment";
      end Columns;
      package Indexes is
         DTS_Started, LPQ_Priority : Non_Unique_Index with Description => "Sort by trigger order";
         LPQ_Group, DTS_Started, LPQ_Priority : Non_Unique_Index with Description => "Group sorting";
      end Indexes;
   end Adm_Job;
   
   --  Excerpt
   
   end Srp.DB;
   

Usage

When you hover the mouse over it, an initial window appears:

When you click on the ‘Go to Ada declaration’ button, a second window displays the relevant specification files:

Although the special keyword “Reference” is not highlighted, hovering over it will bring up a pop-up window reminding you that it is not a type: