1 / 9

Bringing Ada to Eclipse Developers

Bringing Ada to Eclipse Developers. Quentin Ochem Software Engineer. The initial situation. GNAT Development Environment. Eclipse environment. Formatting Quick Fixes Code assist Browsing …. Framework Resources Widgets Plugins …. Subprograms OOP Exceptions Callbacks. JNI.

Ava
Download Presentation

Bringing Ada to Eclipse Developers

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Bringing Ada to Eclipse Developers Quentin Ochem Software Engineer

  2. The initial situation GNAT Development Environment Eclipse environment Formatting Quick Fixes Code assist Browsing … Framework ResourcesWidgets Plugins … Subprograms OOP Exceptions Callbacks JNI Eclipse Plugin

  3. Format command Calls the callback Example : formatting Ada Java JNI Computes format Updates the buffer

  4. Ada Spec to JNI Compiler Overview of the Tool Wrappers to Ada to JNI Ada specs Javahigh level Interface (Wrappers JNI to Java)

  5. Original Ada API package Test is function Addition (A, B : Integer) return Integer; end Test;

  6. Generated code (1 / 3) pragma Warnings (Off); pragma Style_Checks ("NM32766"); with Interfaces.Java.JNI; with AJIS; with AJIS.Internal; with AJIS.Java; with AJIS.Internal.Java; with Ada.Characters.Conversions; with Ada.Finalization; with Test; use Test; package JNI_Binding.Test_JNI.Test_Package_JNI is pragma Elaborate_Body; function Id_JNI_5 (A : Standard.Integer; B : Standard.Integer) return Standard.Integer; function Addition_Id_JNI_4 (Id_JNI_1 : Interfaces.Java.JNI.JNI_Env_Access; Id_JNI_3 : Interfaces.Java.JNI.J_Class; A : Interfaces.Java.JNI.J_Int; B : Interfaces.Java.JNI.J_Int) return Interfaces.Java.JNI.J_Int; pragma Export (C, Addition_Id_JNI_4, "Java_com_adacore_test01_Test_Test_1Package_Addition_1Id_1JNI_14__II"); end JNI_Binding.Test_JNI.Test_Package_JNI;

  7. Generated code (2 / 3) pragma Warnings (Off); pragma Style_Checks ("NM32766"); with Ada.Unchecked_Deallocation; with System.Address_To_Access_Conversions; with Ada.Unchecked_Conversion; with Ada.Tags; with Ada.Exceptions; with Interfaces.C; with Interfaces.C.Strings; with Test; use Test; packagebody JNI_Binding.Test_JNI.Test_Package_JNI is function Id_JNI_5 (A : Standard.Integer; B : Standard.Integer) return Standard.Integer is Id_JNI_7 : Standard.Integer renames Test.Addition (A, B); begin return Id_JNI_7; end Id_JNI_5; function Addition_Id_JNI_4 (Id_JNI_1 : Interfaces.Java.JNI.JNI_Env_Access; Id_JNI_3 : Interfaces.Java.JNI.J_Class; A : Interfaces.Java.JNI.J_Int; B : Interfaces.Java.JNI.J_Int) return Interfaces.Java.JNI.J_Int is begin declare Id_JNI_8 : Interfaces.Java.JNI.J_Int := Interfaces.Java.JNI.J_Int (Id_JNI_5 (Standard.Integer (A), Standard.Integer (B))); begin return Id_JNI_8; end; exception when J : AJIS.Java.Java_Exception => declare Result : Interfaces.Java.JNI.J_Int; begin Result := Interfaces.Java.JNI.Throw (Id_JNI_1, AJIS.Internal.Java.Throwable_Value (Ada.Exceptions.Exception_Message (J))); return 0; end; when E : others => declare Result : Interfaces.Java.JNI.J_Int; begin Result := Interfaces.Java.JNI.Throw_New (Id_JNI_1, Interfaces.Java.JNI.Find_Class (Id_JNI_1, String'("Lcom/adacore/ajis/NativeException;")), Interfaces.C.To_C (Ada.Exceptions.Exception_Information (E))); return 0; end; end Addition_Id_JNI_4; begin null; end JNI_Binding.Test_JNI.Test_Package_JNI;

  8. Generated code (3 / 3) package com.adacore.test01.Test; import com.adacore.test01.Ada2Java.Library; @SuppressWarnings("unused") publicfinalclass Test_Package { staticpublicint Addition (int A, int B){ com.adacore.test01.Ada2Java.Library.lock.lock (); try { int Id_JNI_9 = Addition_Id_JNI_4 (A, B); return Id_JNI_9; } finally { com.adacore.test01.Ada2Java.Library.lock.unlock (); } } // Addition static { com.adacore.test01.Ada2Java.Library.load (); } nativestaticprivateint Addition_Id_JNI_4 (int A, int B); } // Test_Package package com.adacore.test01.Test; publicfinalclass Test_Package { staticpublicint Addition (int A, int B){ } // Addition } // Test_Package

  9. Semantic match package Test; publicclass Rec { public Rec () { // Creates a Rec object on the // native heap. } publicint Func () { // Code … } } package Test is type Rec istaggedprivate; function Func (P : Rec) return Integer; private -- some code end Test;

More Related