Java 2 Ada

Advanced Resource Embedder 1.2.0

By Stephane Carrez

A new version of the Advanced Resource Embedder is now available. The tool allows to embed files in binaries by producing C, Ada or Go source files that contain the file to embed.

Embedding SQL in binary

The new release contains the following fixes:

  • Fix Ada generator to be able to use other binary content types such as System.Storage_Elements.Storage_Array
  • Fix Ada generator to escape special characters in strings

Since the previous version, Fabien Chouteau asked to be able to use an Ada system type to represent a binary content. This is now possible by using the following XML extract for the description to tell the resource embedder how to integrate the file and generate the Ada source code:


<package>
  <resource name='Resources.Help'
            format='binary'
            type='access constant System.Storage_Elements.Storage_Array'>
    <install mode='copy'>
      <fileset dir="help">
        <include name="**/*.txt"/>
      </fileset>
    </install>
  </resource>
  ...
</package>

With the above description, the Ada code generator produces the following package specification:


with System.Storage_Elements;
package Resources.Help is
   type Content_Access is access constant System.Storage_Elements.Storage_Array;
   type Name_Access is access constant String;
   type Name_Array is array (Natural range <>) of Name_Access;
   Names : constant Name_Array;
   function Get_Content (Name : String)
      access constant System.Storage_Elements.Storage_Array;
private
   ...
end Resources.Help;

This example is available in Embedding help and documentation in Ada (binary). If you prefer to use String instead of a Storage_Array, have a look at the Embedding help and documentation in Ada. Both examples are similar but they are exposing the file using different Ada types.

To install the tool, follow the instructions given in the initial announcement: Advanced Resource Embedder for Ada, C and Go.

If you want to know more about the tool, have a look at its documentation:

and if you have ideas for improvements, fork the project and submit a pull request!

Add a comment

To add a comment, you must be connected. Login